relic_link 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/.ruby-version +1 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +47 -38
- data/README.md +2 -2
- data/lib/relic_link/coh3/api/endpoints/leaderboards.rb +11 -3
- data/lib/relic_link/coh3/api/endpoints/matches.rb +11 -2
- data/lib/relic_link/coh3/api/endpoints/replays.rb +56 -0
- data/lib/relic_link/coh3/api/endpoints/stats.rb +7 -1
- data/lib/relic_link/coh3/api/endpoints.rb +2 -0
- data/lib/relic_link/coh3/api/errors/relic_error.rb +1 -1
- data/lib/relic_link/coh3/api/errors.rb +2 -0
- data/lib/relic_link/coh3/faraday/connection.rb +20 -4
- data/lib/relic_link/coh3/faraday/response/raise_http_error.rb +18 -0
- data/lib/relic_link/coh3/faraday/response/raise_replay_error.rb +21 -0
- data/lib/relic_link/coh3/faraday/response/{raise_error.rb → raise_stats_error.rb} +7 -3
- data/lib/relic_link/errors/server_error.rb +15 -1
- data/lib/relic_link/faraday/request.rb +1 -1
- data/lib/relic_link/version.rb +1 -1
- data/lib/relic_link.rb +3 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 933d2d2f0ea7389569d273f910d7c81ccd0abb7f4db84353ba52a537a44fcff8
|
4
|
+
data.tar.gz: 927197b6cf76cc074e4a01bf945f9970005e1c10322ec260f3117022fa39c9ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1a53aefa0bd7708f790901dd03d25446b04702dabf7037abeacdef38127365ba9d5f9ffd37969a5604ca254ed73f08f2fa6908b7eda5cba6427e9e49c314d18
|
7
|
+
data.tar.gz: 5b1286b258c58bd9fcaf29123da22a944a6942a455b955bfe1b7e4e9b8f1951500c495b13e364d58ce3141cc8a8fe323482904b756f7b2f72726cf81d826d657
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.4
|
data/Gemfile
CHANGED
@@ -5,10 +5,10 @@ source 'https://rubygems.org'
|
|
5
5
|
# Specify your gem's dependencies in relic_link.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'rake', '~> 13.
|
8
|
+
gem 'rake', '~> 13.2'
|
9
9
|
|
10
|
-
gem 'rspec', '~> 3.
|
10
|
+
gem 'rspec', '~> 3.13'
|
11
11
|
|
12
|
-
gem 'rubocop', '~> 1.
|
12
|
+
gem 'rubocop', '~> 1.65'
|
13
13
|
|
14
|
-
gem 'vcr', '~> 6.
|
14
|
+
gem 'vcr', '~> 6.2'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relic_link (
|
4
|
+
relic_link (1.2.0)
|
5
5
|
faraday (~> 2.7)
|
6
6
|
faraday-mashify (~> 0.1)
|
7
7
|
hashie (~> 5.0)
|
@@ -10,65 +10,74 @@ GEM
|
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
12
|
ast (2.4.2)
|
13
|
-
diff-lcs (1.5.
|
14
|
-
faraday (2.
|
15
|
-
faraday-net_http (>= 2.0, < 3.
|
16
|
-
|
13
|
+
diff-lcs (1.5.1)
|
14
|
+
faraday (2.10.1)
|
15
|
+
faraday-net_http (>= 2.0, < 3.2)
|
16
|
+
logger
|
17
17
|
faraday-mashify (0.1.1)
|
18
18
|
faraday (~> 2.0)
|
19
19
|
hashie
|
20
|
-
faraday-net_http (3.
|
20
|
+
faraday-net_http (3.1.1)
|
21
|
+
net-http
|
21
22
|
hashie (5.0.0)
|
22
|
-
json (2.
|
23
|
-
|
24
|
-
|
23
|
+
json (2.7.2)
|
24
|
+
language_server-protocol (3.17.0.3)
|
25
|
+
logger (1.6.0)
|
26
|
+
net-http (0.4.1)
|
27
|
+
uri
|
28
|
+
parallel (1.26.1)
|
29
|
+
parser (3.3.4.2)
|
25
30
|
ast (~> 2.4.1)
|
26
31
|
racc
|
27
|
-
racc (1.
|
32
|
+
racc (1.8.1)
|
28
33
|
rainbow (3.1.1)
|
29
|
-
rake (13.
|
30
|
-
regexp_parser (2.
|
31
|
-
rexml (3.
|
32
|
-
|
33
|
-
|
34
|
-
rspec-
|
35
|
-
rspec-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
rake (13.2.1)
|
35
|
+
regexp_parser (2.9.2)
|
36
|
+
rexml (3.3.4)
|
37
|
+
strscan
|
38
|
+
rspec (3.13.0)
|
39
|
+
rspec-core (~> 3.13.0)
|
40
|
+
rspec-expectations (~> 3.13.0)
|
41
|
+
rspec-mocks (~> 3.13.0)
|
42
|
+
rspec-core (3.13.0)
|
43
|
+
rspec-support (~> 3.13.0)
|
44
|
+
rspec-expectations (3.13.1)
|
39
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
46
|
+
rspec-support (~> 3.13.0)
|
47
|
+
rspec-mocks (3.13.1)
|
42
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
rubocop (1.
|
49
|
+
rspec-support (~> 3.13.0)
|
50
|
+
rspec-support (3.13.1)
|
51
|
+
rubocop (1.65.1)
|
46
52
|
json (~> 2.3)
|
53
|
+
language_server-protocol (>= 3.17.0)
|
47
54
|
parallel (~> 1.10)
|
48
|
-
parser (>= 3.
|
55
|
+
parser (>= 3.3.0.2)
|
49
56
|
rainbow (>= 2.2.2, < 4.0)
|
50
|
-
regexp_parser (>=
|
57
|
+
regexp_parser (>= 2.4, < 3.0)
|
51
58
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
59
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
53
60
|
ruby-progressbar (~> 1.7)
|
54
61
|
unicode-display_width (>= 2.4.0, < 3.0)
|
55
|
-
rubocop-ast (1.
|
56
|
-
parser (>= 3.
|
62
|
+
rubocop-ast (1.32.0)
|
63
|
+
parser (>= 3.3.1.0)
|
57
64
|
ruby-progressbar (1.13.0)
|
58
|
-
|
59
|
-
unicode-display_width (2.
|
60
|
-
|
65
|
+
strscan (3.1.0)
|
66
|
+
unicode-display_width (2.5.0)
|
67
|
+
uri (0.13.0)
|
68
|
+
vcr (6.2.0)
|
61
69
|
|
62
70
|
PLATFORMS
|
63
71
|
arm64-darwin-21
|
72
|
+
arm64-darwin-23
|
64
73
|
x86_64-linux
|
65
74
|
|
66
75
|
DEPENDENCIES
|
67
|
-
rake (~> 13.
|
76
|
+
rake (~> 13.2)
|
68
77
|
relic_link!
|
69
|
-
rspec (~> 3.
|
70
|
-
rubocop (~> 1.
|
71
|
-
vcr (~> 6.
|
78
|
+
rspec (~> 3.13)
|
79
|
+
rubocop (~> 1.65)
|
80
|
+
vcr (~> 6.2)
|
72
81
|
|
73
82
|
BUNDLED WITH
|
74
|
-
2.
|
83
|
+
2.5.17
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RelicLink
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/relic_link) [](https://rubydoc.info/github/ryantaylor/relic_link/v1.
|
3
|
+
[](https://badge.fury.io/rb/relic_link) [](https://rubydoc.info/github/ryantaylor/relic_link/v1.2.0)
|
4
4
|
|
5
5
|
A client wrapper for Relic APIs. Currently supports the Company of Heroes 3 leaderboard, stats, and recent matches API.
|
6
6
|
|
@@ -29,7 +29,7 @@ client.recent_match_history(profile_ids: [8230])
|
|
29
29
|
client.recent_match_history_by_profile_id(8230)
|
30
30
|
client.personal_stats(profile_ids: [8230])
|
31
31
|
```
|
32
|
-
Consult the [documentation](https://rubydoc.info/github/ryantaylor/relic_link/v1.
|
32
|
+
Consult the [documentation](https://rubydoc.info/github/ryantaylor/relic_link/v1.2.0) for all endpoints that have been discovered and are currently queryable. Note that Relic does not publish official documentation for their endpoints, so the functionality here is based on best estimates and is subject to change without warning. Please open an issue if you are aware of endpoints that are not exposed in this library!
|
33
33
|
|
34
34
|
## Contributing
|
35
35
|
|
@@ -10,8 +10,11 @@ module RelicLink
|
|
10
10
|
# Endpoint definitions for the CoH3 leaderboards API.
|
11
11
|
module Leaderboards
|
12
12
|
# List available leaderboards and associated metadata.
|
13
|
+
#
|
14
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
15
|
+
# @raise [RelicLink::Errors::RateLimitError] if you're rate-limited.
|
13
16
|
def available_leaderboards
|
14
|
-
get('getAvailableLeaderboards')
|
17
|
+
get(stats, 'getAvailableLeaderboards')
|
15
18
|
end
|
16
19
|
|
17
20
|
# Retrieve the leaderboard with the given ID. For your convenience
|
@@ -31,13 +34,18 @@ module RelicLink
|
|
31
34
|
# Field to sort the leaderboard entries by.
|
32
35
|
#
|
33
36
|
# @raise [ArgumentError] if the required parameters aren't provided.
|
37
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
38
|
+
# @raise [RelicLink::Errors::RateLimitError] if you're rate-limited.
|
39
|
+
# @raise [Errors::NotFound] if +leaderboard_id+ does not correspond to a leaderboard.
|
40
|
+
# @raise [RelicLink::Errors::BadRequestError] if +start+, +count+, or +sort_by+ are outside the
|
41
|
+
# limits enumerated above.
|
34
42
|
def leaderboard(options = {})
|
35
43
|
raise ArgumentError, 'Required argument :leaderboard_id missing' if options[:leaderboard_id].nil?
|
36
44
|
|
37
|
-
get('getLeaderboard2', format_sort_key(options))
|
45
|
+
get(stats, 'getLeaderboard2', format_sort_key(options))
|
38
46
|
end
|
39
47
|
|
40
|
-
|
48
|
+
private
|
41
49
|
|
42
50
|
def format_sort_key(options)
|
43
51
|
options.transform_keys do |key|
|
@@ -22,12 +22,18 @@ module RelicLink
|
|
22
22
|
# be in the format +/steam/<ID>+ (one of required).
|
23
23
|
#
|
24
24
|
# @raise [ArgumentError] if none of the required parameters are provided.
|
25
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
26
|
+
# @raise [RelicLink::Errors::RateLimitError] if you're rate-limited.
|
27
|
+
# @raise [Errors::UnknownProfileIds] if no values in +profile_ids+ match known profile IDs.
|
28
|
+
# @raise [Errors::UnknownAliases] if no values in +aliases+ match known aliases.
|
29
|
+
# @raise [Errors::UnregisteredProfileName] if no values in +profile_names+ match known profile names.
|
30
|
+
# @raise [RelicLink::Errors::BadRequestError] if inputs violate type constraints.
|
25
31
|
def recent_match_history(options = {})
|
26
32
|
unless options.keys.intersect?(%i[profile_ids aliases profile_names])
|
27
33
|
raise ArgumentError, 'Missing one of required arguments :profile_ids, :aliases, or :profile_names'
|
28
34
|
end
|
29
35
|
|
30
|
-
get('getRecentMatchHistory', array_params(options))
|
36
|
+
get(stats, 'getRecentMatchHistory', array_params(options))
|
31
37
|
end
|
32
38
|
|
33
39
|
# Retrieve the match history information for the given profile ID. Profile
|
@@ -39,10 +45,13 @@ module RelicLink
|
|
39
45
|
# @param profile_id [Integer] Internal Relic ID of player whose stats you wish to retrieve (required).
|
40
46
|
#
|
41
47
|
# @raise [ArgumentError] if no +profile_id+ provided.
|
48
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
49
|
+
# @raise [RelicLink::Errors::RateLimitError] if you're rate-limited.
|
50
|
+
# @raise [RelicLink::Errors::BadRequestError] if input violates type constraints.
|
42
51
|
def recent_match_history_by_profile_id(profile_id)
|
43
52
|
raise ArgumentError, 'Required argument :profile_id missing' if profile_id.nil?
|
44
53
|
|
45
|
-
get('getRecentMatchHistoryByProfileId', { profile_id: })
|
54
|
+
get(stats, 'getRecentMatchHistoryByProfileId', { profile_id: })
|
46
55
|
end
|
47
56
|
end
|
48
57
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RelicLink
|
4
|
+
module Coh3
|
5
|
+
module Api
|
6
|
+
module Endpoints
|
7
|
+
# Endpoint definitions for the internal CoH3 replays API.
|
8
|
+
module Replays
|
9
|
+
# Request a signed download URL for a replay at the given +path+, using the given
|
10
|
+
# authentication +token+. Path values can be retrieved from any endpoint that returns
|
11
|
+
# a player's game history, by looking for a +matchurls+ key in the JSON response.
|
12
|
+
# Note that this is a protected internal endpoint, which means a request without a
|
13
|
+
# valid token will return an authentication error. Tokens can be extracted from the
|
14
|
+
# game client by setting up a man-in-the-middle proxy between your game client and
|
15
|
+
# the Relic servers, but be warned that tokens expire quickly and this endpoint may
|
16
|
+
# change at any time. Use at your own risk!
|
17
|
+
#
|
18
|
+
# Relic generally keeps a player's 10 most recent replay files, and files older than
|
19
|
+
# that are removed from storage and inaccessible. When this happens, the replay is
|
20
|
+
# considered expired and requests for that path will raise an error.
|
21
|
+
#
|
22
|
+
# @option options [String] :token
|
23
|
+
# Valid CoH3 game client authentication token (required)
|
24
|
+
# @option options [String] :path
|
25
|
+
# Path to a CoH3 replay file stored on Relic's infrastructure (required)
|
26
|
+
#
|
27
|
+
# @raise [ArgumentError] if one of the required parameters are not provided.
|
28
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
29
|
+
# @raise [RelicLink::Errors::UnauthorizedError] if the +token+ provided is invalid.
|
30
|
+
# @raise [Errors::ExpiredPath] if the file at the +path+ provided has expired or does not exist.
|
31
|
+
def replay_url(options = {})
|
32
|
+
validate_options!(options)
|
33
|
+
get(replays, 'requestSignedReplayDownloadUri', {
|
34
|
+
connect_id: options[:token],
|
35
|
+
key: options[:path],
|
36
|
+
sessionID: options[:token]
|
37
|
+
})
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def validate_options!(options)
|
43
|
+
missing = []
|
44
|
+
missing << 'token' if options[:token].nil?
|
45
|
+
missing << 'path' if options[:path].nil?
|
46
|
+
missing_str = missing.map { |s| ":#{s}" }.join(', ')
|
47
|
+
|
48
|
+
raise ArgumentError, "Missing required params #{missing_str}" unless missing.empty?
|
49
|
+
|
50
|
+
true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -22,12 +22,18 @@ module RelicLink
|
|
22
22
|
# be in the format +/steam/<ID>+ (one of required).
|
23
23
|
#
|
24
24
|
# @raise [ArgumentError] if none of the required parameters are provided.
|
25
|
+
# @raise [RelicLink::Errors::ServerError] if Relic's API is down.
|
26
|
+
# @raise [RelicLink::Errors::RateLimitError] if you're rate-limited.
|
27
|
+
# @raise [Errors::UnknownProfileIds] if no values in +profile_ids+ match known profile IDs.
|
28
|
+
# @raise [Errors::UnknownAliases] if no values in +aliases+ match known aliases.
|
29
|
+
# @raise [Errors::UnregisteredProfileName] if no values in +profile_names+ match known profile names.
|
30
|
+
# @raise [RelicLink::Errors::BadRequestError] if inputs violate type constraints.
|
25
31
|
def personal_stats(options = {})
|
26
32
|
unless options.keys.intersect?(%i[profile_ids aliases profile_names])
|
27
33
|
raise ArgumentError, 'Missing one of required params :profile_ids, :aliases, or :profile_names'
|
28
34
|
end
|
29
35
|
|
30
|
-
get('getPersonalStat', array_params(options))
|
36
|
+
get(stats, 'getPersonalStat', array_params(options))
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative 'endpoints/leaderboards'
|
4
4
|
require_relative 'endpoints/matches'
|
5
|
+
require_relative 'endpoints/replays'
|
5
6
|
require_relative 'endpoints/stats'
|
6
7
|
|
7
8
|
module RelicLink
|
@@ -10,6 +11,7 @@ module RelicLink
|
|
10
11
|
module Endpoints
|
11
12
|
include Leaderboards
|
12
13
|
include Matches
|
14
|
+
include Replays
|
13
15
|
include Stats
|
14
16
|
end
|
15
17
|
end
|
@@ -5,6 +5,8 @@ module RelicLink
|
|
5
5
|
module Api
|
6
6
|
# Errors specific to the Relic CoH3 API.
|
7
7
|
module Errors
|
8
|
+
# Raised when querying for a replay URL with a path that has expired.
|
9
|
+
class ExpiredPath < RelicError; end
|
8
10
|
# Raised when querying for a leaderboard that doesn't exist.
|
9
11
|
class NotFound < RelicError; end
|
10
12
|
# Raised when querying for aliases that don't exist.
|
@@ -8,15 +8,31 @@ module RelicLink
|
|
8
8
|
# Faraday connection implementation for API requests. You shouldn't
|
9
9
|
# ever have to use this directly.
|
10
10
|
module Connection
|
11
|
-
|
11
|
+
private
|
12
12
|
|
13
|
-
def
|
14
|
-
@
|
13
|
+
def stats
|
14
|
+
@stats ||= ::Faraday.new(
|
15
15
|
url: 'https://coh3-api.reliclink.com/community/leaderboard'
|
16
16
|
) do |f|
|
17
17
|
f.params[:title] = 'coh3'
|
18
18
|
|
19
|
-
f.use ::RelicLink::Coh3::Faraday::Response::
|
19
|
+
f.use ::RelicLink::Coh3::Faraday::Response::RaiseHttpError
|
20
|
+
f.use ::RelicLink::Coh3::Faraday::Response::RaiseStatsError
|
21
|
+
f.response :mashify
|
22
|
+
f.response :json
|
23
|
+
f.use ::RelicLink::Faraday::Response::WrapError
|
24
|
+
f.response :logger, logger if logger
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def replays
|
29
|
+
@replays ||= ::Faraday.new(
|
30
|
+
url: 'https://coh3-api.reliclink.com/game/Replay'
|
31
|
+
) do |f|
|
32
|
+
f.params[:callNum] = rand(5..354)
|
33
|
+
|
34
|
+
f.use ::RelicLink::Coh3::Faraday::Response::RaiseHttpError
|
35
|
+
f.use ::RelicLink::Coh3::Faraday::Response::RaiseReplayError
|
20
36
|
f.response :mashify
|
21
37
|
f.response :json
|
22
38
|
f.use ::RelicLink::Faraday::Response::WrapError
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RelicLink
|
4
|
+
module Coh3
|
5
|
+
module Faraday
|
6
|
+
module Response
|
7
|
+
# Middleware to catch CoH3 API errors and raise them as exceptions.
|
8
|
+
class RaiseHttpError < ::Faraday::Middleware
|
9
|
+
def on_complete(env)
|
10
|
+
raise RelicLink::Errors::BadRequestError, env.response if env.status == 400
|
11
|
+
raise RelicLink::Errors::UnauthorizedError, env.response if env.status == 401
|
12
|
+
raise RelicLink::Errors::RateLimitError, env.response if env.status == 429
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RelicLink
|
4
|
+
module Coh3
|
5
|
+
module Faraday
|
6
|
+
module Response
|
7
|
+
# Middleware to catch CoH3 API errors and raise them as exceptions.
|
8
|
+
class RaiseReplayError < ::Faraday::Middleware
|
9
|
+
def on_complete(env)
|
10
|
+
return unless env.success?
|
11
|
+
|
12
|
+
body = env.body
|
13
|
+
return unless body
|
14
|
+
|
15
|
+
raise RelicLink::Coh3::Api::Errors::ExpiredPath.new('path has expired', env.response) if body.first == 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -5,10 +5,8 @@ module RelicLink
|
|
5
5
|
module Faraday
|
6
6
|
module Response
|
7
7
|
# Middleware to catch CoH3 API errors and raise them as exceptions.
|
8
|
-
class
|
8
|
+
class RaiseStatsError < ::Faraday::Middleware
|
9
9
|
def on_complete(env)
|
10
|
-
raise RelicLink::Errors::BadRequestError, env.response if env.status == 400
|
11
|
-
|
12
10
|
return unless env.success?
|
13
11
|
|
14
12
|
body = env.body
|
@@ -16,6 +14,12 @@ module RelicLink
|
|
16
14
|
|
17
15
|
return if body['result']['code'].zero?
|
18
16
|
|
17
|
+
raise_relic_error!(body, env)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def raise_relic_error!(body, env)
|
19
23
|
error_message = body['result']['message']
|
20
24
|
error_class = RelicLink::Coh3::Api::Errors::ERROR_CLASSES[error_message]
|
21
25
|
error_class ||= RelicLink::Coh3::Api::Errors::RelicError
|
@@ -8,7 +8,7 @@ module RelicLink
|
|
8
8
|
|
9
9
|
def initialize(message, response)
|
10
10
|
@response = response
|
11
|
-
super
|
11
|
+
super(message)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -29,6 +29,20 @@ module RelicLink
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
# Raised when a 401 is returned in an API response
|
33
|
+
class UnauthorizedError < HttpRequestError
|
34
|
+
def initialize(response)
|
35
|
+
super('unauthorized', response)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Raised when a 429 is returned in an API response.
|
40
|
+
class RateLimitError < HttpRequestError
|
41
|
+
def initialize(response)
|
42
|
+
super('rate_limited', response)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
32
46
|
# Raised when an API request times out.
|
33
47
|
class TimeoutError < HttpRequestError
|
34
48
|
def initialize(response)
|
@@ -5,7 +5,7 @@ module RelicLink
|
|
5
5
|
# Wrapper for HTTP client +GET+ requests. You should never
|
6
6
|
# have to use this directly.
|
7
7
|
module Request
|
8
|
-
def get(path, options = {})
|
8
|
+
def get(connection, path, options = {})
|
9
9
|
connection.get(path) do |req|
|
10
10
|
req.params = req.params.merge(options)
|
11
11
|
end.body
|
data/lib/relic_link/version.rb
CHANGED
data/lib/relic_link.rb
CHANGED
@@ -11,7 +11,9 @@ require_relative 'relic_link/errors/server_error'
|
|
11
11
|
require_relative 'relic_link/coh3/api/errors/relic_error'
|
12
12
|
require_relative 'relic_link/coh3/api/error'
|
13
13
|
require_relative 'relic_link/coh3/api/errors'
|
14
|
-
require_relative 'relic_link/coh3/faraday/response/
|
14
|
+
require_relative 'relic_link/coh3/faraday/response/raise_http_error'
|
15
|
+
require_relative 'relic_link/coh3/faraday/response/raise_replay_error'
|
16
|
+
require_relative 'relic_link/coh3/faraday/response/raise_stats_error'
|
15
17
|
require_relative 'relic_link/faraday/response/wrap_error'
|
16
18
|
|
17
19
|
require_relative 'relic_link/coh3/util'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relic_link
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/relic_link/coh3/api/endpoints/leaderboards/ids.rb
|
76
76
|
- lib/relic_link/coh3/api/endpoints/leaderboards/sort.rb
|
77
77
|
- lib/relic_link/coh3/api/endpoints/matches.rb
|
78
|
+
- lib/relic_link/coh3/api/endpoints/replays.rb
|
78
79
|
- lib/relic_link/coh3/api/endpoints/stats.rb
|
79
80
|
- lib/relic_link/coh3/api/error.rb
|
80
81
|
- lib/relic_link/coh3/api/errors.rb
|
@@ -82,7 +83,9 @@ files:
|
|
82
83
|
- lib/relic_link/coh3/client.rb
|
83
84
|
- lib/relic_link/coh3/config.rb
|
84
85
|
- lib/relic_link/coh3/faraday/connection.rb
|
85
|
-
- lib/relic_link/coh3/faraday/response/
|
86
|
+
- lib/relic_link/coh3/faraday/response/raise_http_error.rb
|
87
|
+
- lib/relic_link/coh3/faraday/response/raise_replay_error.rb
|
88
|
+
- lib/relic_link/coh3/faraday/response/raise_stats_error.rb
|
86
89
|
- lib/relic_link/coh3/util.rb
|
87
90
|
- lib/relic_link/errors/server_error.rb
|
88
91
|
- lib/relic_link/faraday/request.rb
|
@@ -114,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
117
|
- !ruby/object:Gem::Version
|
115
118
|
version: '0'
|
116
119
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.5.10
|
118
121
|
signing_key:
|
119
122
|
specification_version: 4
|
120
123
|
summary: Wrapper for Relic APIs
|