relic_link 1.0.0 → 1.1.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 +3 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +40 -36
- data/README.md +2 -2
- data/lib/relic_link/coh3/api/endpoints/leaderboards.rb +9 -1
- data/lib/relic_link/coh3/api/endpoints/matches.rb +9 -0
- data/lib/relic_link/coh3/api/endpoints/stats.rb +6 -0
- data/lib/relic_link/coh3/api/errors/relic_error.rb +1 -1
- data/lib/relic_link/coh3/faraday/connection.rb +1 -1
- data/lib/relic_link/coh3/faraday/response/raise_error.rb +7 -0
- data/lib/relic_link/errors/server_error.rb +8 -1
- data/lib/relic_link/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0a6925bd59c93badd256bc6e31c23cf2ecd58827b93b604f2ce4fd954924ee5
|
4
|
+
data.tar.gz: 68e0f9f49e38f2c5d7b6e870684828c21bc88e9d4ecd56c4a7d6245e94462d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b6b44e95aab707016e1825eecd7f952f63bdceb299b5622fa6d61b27e8930b7559066eab6fd35f83aa4be2131713bab4c17097cb86f46abe878d7bba3228480
|
7
|
+
data.tar.gz: cf4eec64ecffecffb3e4d0e313c5fc0f6c66d5135103be65ddffa4c8251c9d960afbaa706c945290e5c6ce160eaeb18f39a2e4d5055db212906ce8811d1a1e08
|
data/.rubocop.yml
CHANGED
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.1'
|
9
9
|
|
10
|
-
gem 'rspec', '~> 3.
|
10
|
+
gem 'rspec', '~> 3.13'
|
11
11
|
|
12
|
-
gem 'rubocop', '~> 1.
|
12
|
+
gem 'rubocop', '~> 1.61'
|
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.1.0)
|
5
5
|
faraday (~> 2.7)
|
6
6
|
faraday-mashify (~> 0.1)
|
7
7
|
hashie (~> 5.0)
|
@@ -10,65 +10,69 @@ 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
|
-
ruby2_keywords (>= 0.0.4)
|
13
|
+
diff-lcs (1.5.1)
|
14
|
+
faraday (2.9.0)
|
15
|
+
faraday-net_http (>= 2.0, < 3.2)
|
17
16
|
faraday-mashify (0.1.1)
|
18
17
|
faraday (~> 2.0)
|
19
18
|
hashie
|
20
|
-
faraday-net_http (3.0
|
19
|
+
faraday-net_http (3.1.0)
|
20
|
+
net-http
|
21
21
|
hashie (5.0.0)
|
22
|
-
json (2.
|
23
|
-
|
24
|
-
|
22
|
+
json (2.7.1)
|
23
|
+
language_server-protocol (3.17.0.3)
|
24
|
+
net-http (0.4.1)
|
25
|
+
uri
|
26
|
+
parallel (1.24.0)
|
27
|
+
parser (3.3.0.5)
|
25
28
|
ast (~> 2.4.1)
|
26
29
|
racc
|
27
|
-
racc (1.7.
|
30
|
+
racc (1.7.3)
|
28
31
|
rainbow (3.1.1)
|
29
|
-
rake (13.0
|
30
|
-
regexp_parser (2.
|
31
|
-
rexml (3.2.
|
32
|
-
rspec (3.
|
33
|
-
rspec-core (~> 3.
|
34
|
-
rspec-expectations (~> 3.
|
35
|
-
rspec-mocks (~> 3.
|
36
|
-
rspec-core (3.
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-expectations (3.
|
32
|
+
rake (13.1.0)
|
33
|
+
regexp_parser (2.9.0)
|
34
|
+
rexml (3.2.6)
|
35
|
+
rspec (3.13.0)
|
36
|
+
rspec-core (~> 3.13.0)
|
37
|
+
rspec-expectations (~> 3.13.0)
|
38
|
+
rspec-mocks (~> 3.13.0)
|
39
|
+
rspec-core (3.13.0)
|
40
|
+
rspec-support (~> 3.13.0)
|
41
|
+
rspec-expectations (3.13.0)
|
39
42
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-mocks (3.
|
43
|
+
rspec-support (~> 3.13.0)
|
44
|
+
rspec-mocks (3.13.0)
|
42
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-support (3.
|
45
|
-
rubocop (1.
|
46
|
+
rspec-support (~> 3.13.0)
|
47
|
+
rspec-support (3.13.1)
|
48
|
+
rubocop (1.61.0)
|
46
49
|
json (~> 2.3)
|
50
|
+
language_server-protocol (>= 3.17.0)
|
47
51
|
parallel (~> 1.10)
|
48
|
-
parser (>= 3.
|
52
|
+
parser (>= 3.3.0.2)
|
49
53
|
rainbow (>= 2.2.2, < 4.0)
|
50
54
|
regexp_parser (>= 1.8, < 3.0)
|
51
55
|
rexml (>= 3.2.5, < 4.0)
|
52
|
-
rubocop-ast (>= 1.
|
56
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
53
57
|
ruby-progressbar (~> 1.7)
|
54
58
|
unicode-display_width (>= 2.4.0, < 3.0)
|
55
|
-
rubocop-ast (1.
|
56
|
-
parser (>= 3.
|
59
|
+
rubocop-ast (1.31.1)
|
60
|
+
parser (>= 3.3.0.4)
|
57
61
|
ruby-progressbar (1.13.0)
|
58
|
-
|
59
|
-
|
60
|
-
vcr (6.
|
62
|
+
unicode-display_width (2.5.0)
|
63
|
+
uri (0.13.0)
|
64
|
+
vcr (6.2.0)
|
61
65
|
|
62
66
|
PLATFORMS
|
63
67
|
arm64-darwin-21
|
64
68
|
x86_64-linux
|
65
69
|
|
66
70
|
DEPENDENCIES
|
67
|
-
rake (~> 13.
|
71
|
+
rake (~> 13.1)
|
68
72
|
relic_link!
|
69
|
-
rspec (~> 3.
|
70
|
-
rubocop (~> 1.
|
71
|
-
vcr (~> 6.
|
73
|
+
rspec (~> 3.13)
|
74
|
+
rubocop (~> 1.61)
|
75
|
+
vcr (~> 6.2)
|
72
76
|
|
73
77
|
BUNDLED WITH
|
74
78
|
2.4.7
|
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.1.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.1.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,6 +10,9 @@ 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
17
|
get('getAvailableLeaderboards')
|
15
18
|
end
|
@@ -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
45
|
get('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,6 +22,12 @@ 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'
|
@@ -39,6 +45,9 @@ 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
|
|
@@ -22,6 +22,12 @@ 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'
|
@@ -8,6 +8,7 @@ module RelicLink
|
|
8
8
|
class RaiseError < ::Faraday::Middleware
|
9
9
|
def on_complete(env)
|
10
10
|
raise RelicLink::Errors::BadRequestError, env.response if env.status == 400
|
11
|
+
raise RelicLink::Errors::RateLimitError, env.response if env.status == 429
|
11
12
|
|
12
13
|
return unless env.success?
|
13
14
|
|
@@ -16,6 +17,12 @@ module RelicLink
|
|
16
17
|
|
17
18
|
return if body['result']['code'].zero?
|
18
19
|
|
20
|
+
raise_relic_error!(body, env)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def raise_relic_error!(body, env)
|
19
26
|
error_message = body['result']['message']
|
20
27
|
error_class = RelicLink::Coh3::Api::Errors::ERROR_CLASSES[error_message]
|
21
28
|
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,13 @@ module RelicLink
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
# Raised when a 429 is returned in an API response.
|
33
|
+
class RateLimitError < HttpRequestError
|
34
|
+
def initialize(response)
|
35
|
+
super('rate_limited', response)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
32
39
|
# Raised when an API request times out.
|
33
40
|
class TimeoutError < HttpRequestError
|
34
41
|
def initialize(response)
|
data/lib/relic_link/version.rb
CHANGED
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.1.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-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|