relic_link 0.1.0 → 0.1.2
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/Gemfile.lock +16 -9
- data/README.md +3 -1
- data/lib/relic_link/coh3/client.rb +28 -0
- data/lib/relic_link/coh3/config.rb +40 -0
- data/lib/relic_link/coh3/faraday/connection.rb +4 -1
- data/lib/relic_link/logger.rb +20 -0
- data/lib/relic_link/version.rb +1 -1
- data/lib/relic_link.rb +4 -0
- data/relic_link.gemspec +3 -1
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2c116d6c2b0d54175c3bd00e7989271a969cda9f449e9a4ed2cf39e9680a830
|
4
|
+
data.tar.gz: 7fc992b307a307571689b9b882a749f98b9b704e91c33e96a1efc2ab98283148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe144e6f63b10cf4692c796860aa35d682d4e9738aab9ac0af471465ec7415628d36825581f2f505f07b40af7013052cfd8d82e647c5113b250325b8424127e8
|
7
|
+
data.tar.gz: 9c84ca93917faf1262bbdcd49446ec5d6bf813df88e984bf33c19c3665a37c3b7b34b6056485e8fb9cb45c06fb71a236c2a810633eeff6d8e63cd09b30260973
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relic_link (0.1.
|
4
|
+
relic_link (0.1.1)
|
5
5
|
faraday (~> 2.7)
|
6
|
+
faraday-mashify (~> 0.1)
|
7
|
+
hashie (~> 5.0)
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: https://rubygems.org/
|
@@ -12,39 +14,43 @@ GEM
|
|
12
14
|
faraday (2.7.4)
|
13
15
|
faraday-net_http (>= 2.0, < 3.1)
|
14
16
|
ruby2_keywords (>= 0.0.4)
|
17
|
+
faraday-mashify (0.1.1)
|
18
|
+
faraday (~> 2.0)
|
19
|
+
hashie
|
15
20
|
faraday-net_http (3.0.2)
|
21
|
+
hashie (5.0.0)
|
16
22
|
json (2.6.3)
|
17
|
-
parallel (1.
|
18
|
-
parser (3.2.2.
|
23
|
+
parallel (1.23.0)
|
24
|
+
parser (3.2.2.1)
|
19
25
|
ast (~> 2.4.1)
|
20
26
|
rainbow (3.1.1)
|
21
27
|
rake (13.0.6)
|
22
|
-
regexp_parser (2.
|
28
|
+
regexp_parser (2.8.0)
|
23
29
|
rexml (3.2.5)
|
24
30
|
rspec (3.12.0)
|
25
31
|
rspec-core (~> 3.12.0)
|
26
32
|
rspec-expectations (~> 3.12.0)
|
27
33
|
rspec-mocks (~> 3.12.0)
|
28
|
-
rspec-core (3.12.
|
34
|
+
rspec-core (3.12.2)
|
29
35
|
rspec-support (~> 3.12.0)
|
30
|
-
rspec-expectations (3.12.
|
36
|
+
rspec-expectations (3.12.3)
|
31
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
38
|
rspec-support (~> 3.12.0)
|
33
39
|
rspec-mocks (3.12.5)
|
34
40
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
41
|
rspec-support (~> 3.12.0)
|
36
42
|
rspec-support (3.12.0)
|
37
|
-
rubocop (1.
|
43
|
+
rubocop (1.50.2)
|
38
44
|
json (~> 2.3)
|
39
45
|
parallel (~> 1.10)
|
40
46
|
parser (>= 3.2.0.0)
|
41
47
|
rainbow (>= 2.2.2, < 4.0)
|
42
48
|
regexp_parser (>= 1.8, < 3.0)
|
43
49
|
rexml (>= 3.2.5, < 4.0)
|
44
|
-
rubocop-ast (>= 1.
|
50
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
45
51
|
ruby-progressbar (~> 1.7)
|
46
52
|
unicode-display_width (>= 2.4.0, < 3.0)
|
47
|
-
rubocop-ast (1.28.
|
53
|
+
rubocop-ast (1.28.1)
|
48
54
|
parser (>= 3.2.1.0)
|
49
55
|
ruby-progressbar (1.13.0)
|
50
56
|
ruby2_keywords (0.0.5)
|
@@ -53,6 +59,7 @@ GEM
|
|
53
59
|
|
54
60
|
PLATFORMS
|
55
61
|
arm64-darwin-21
|
62
|
+
x86_64-linux
|
56
63
|
|
57
64
|
DEPENDENCIES
|
58
65
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RelicLink
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/relic_link) [](https://rubydoc.info/github/ryantaylor/relic_link/v0.1.2)
|
4
|
+
|
3
5
|
A client wrapper for Relic APIs. Currently supports the Company of Heroes 3 leaderboard, stats, and recent matches API.
|
4
6
|
|
5
7
|
## Installation
|
@@ -27,7 +29,7 @@ client.recent_match_history(profile_ids: [8230])
|
|
27
29
|
client.recent_match_history_by_profile_id(8230)
|
28
30
|
client.personal_stats(profile_ids: [8230])
|
29
31
|
```
|
30
|
-
Consult the documentation 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!
|
32
|
+
Consult the [documentation](https://rubydoc.info/github/ryantaylor/relic_link/v0.1.2) 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!
|
31
33
|
|
32
34
|
## Contributing
|
33
35
|
|
@@ -13,6 +13,34 @@ module RelicLink
|
|
13
13
|
include Faraday::Connection
|
14
14
|
include Api::Endpoints
|
15
15
|
include Util
|
16
|
+
|
17
|
+
attr_accessor(*RelicLink::Coh3::Config::ATTRIBUTES)
|
18
|
+
|
19
|
+
# Initializes a new client.
|
20
|
+
#
|
21
|
+
# @option options [Logger] :logger
|
22
|
+
# Instance of a logging class. If not provided, defaults to +STDOUT+ at +Logging::WARN+.
|
23
|
+
#
|
24
|
+
# @return [Client]
|
25
|
+
def initialize(options = {})
|
26
|
+
RelicLink::Coh3::Config::ATTRIBUTES.each do |key|
|
27
|
+
send("#{key}=", options.fetch(key, RelicLink::Coh3.config.send(key)))
|
28
|
+
end
|
29
|
+
@logger ||= RelicLink::Coh3::Config.logger || RelicLink::Logger.default
|
30
|
+
end
|
31
|
+
|
32
|
+
class << self
|
33
|
+
# Set configuration options. Can be set on the returned object
|
34
|
+
# directly or in a block.
|
35
|
+
def configure
|
36
|
+
block_given? ? yield(RelicLink::Coh3::Config) : RelicLink::Coh3::Config
|
37
|
+
end
|
38
|
+
|
39
|
+
# Current config module.
|
40
|
+
def config
|
41
|
+
RelicLink::Coh3::Config
|
42
|
+
end
|
43
|
+
end
|
16
44
|
end
|
17
45
|
end
|
18
46
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RelicLink
|
4
|
+
# Company of Heroes 3 API wrapper.
|
5
|
+
module Coh3
|
6
|
+
# Configuration options for the CoH3 API client.
|
7
|
+
module Config
|
8
|
+
extend self
|
9
|
+
|
10
|
+
# Configurable attributes
|
11
|
+
ATTRIBUTES = %i[
|
12
|
+
logger
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
attr_accessor(*ATTRIBUTES)
|
16
|
+
|
17
|
+
# Set all config options back to defaults.
|
18
|
+
def reset
|
19
|
+
self.logger = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
module_function :reset
|
23
|
+
end
|
24
|
+
|
25
|
+
class << self
|
26
|
+
# Set configuration options. Can be set on the returned object
|
27
|
+
# directly or in a block.
|
28
|
+
def configure
|
29
|
+
block_given? ? yield(Config) : Config
|
30
|
+
end
|
31
|
+
|
32
|
+
# Current config module.
|
33
|
+
def config
|
34
|
+
Config
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
RelicLink::Coh3::Config.reset
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'faraday/mashify'
|
4
|
+
|
3
5
|
module RelicLink
|
4
6
|
module Coh3
|
5
7
|
module Faraday
|
@@ -14,7 +16,8 @@ module RelicLink
|
|
14
16
|
) do |f|
|
15
17
|
f.params[:title] = 'coh3'
|
16
18
|
|
17
|
-
f.response :logger
|
19
|
+
f.response :logger, logger if logger
|
20
|
+
f.response :mashify
|
18
21
|
f.response :json
|
19
22
|
end
|
20
23
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
module RelicLink
|
6
|
+
# Default logging class.
|
7
|
+
class Logger < ::Logger
|
8
|
+
# Default logger, used when a logger is not provided in config.
|
9
|
+
# Default log output is +STDOUT+ and log level is +Logger::WARN+.
|
10
|
+
#
|
11
|
+
# @return [::Logger]
|
12
|
+
def self.default
|
13
|
+
return @default if @default
|
14
|
+
|
15
|
+
logger = new STDOUT
|
16
|
+
logger.level = Logger::WARN
|
17
|
+
@default = logger
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/relic_link/version.rb
CHANGED
data/lib/relic_link.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'faraday'
|
4
|
+
require 'hashie'
|
4
5
|
require 'json'
|
5
6
|
|
7
|
+
require_relative 'relic_link/logger'
|
8
|
+
require_relative 'relic_link/coh3/config'
|
9
|
+
|
6
10
|
require_relative 'relic_link/coh3/util'
|
7
11
|
require_relative 'relic_link/coh3/api/endpoints'
|
8
12
|
require_relative 'relic_link/faraday/request'
|
data/relic_link.gemspec
CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = '>= 3.1.0'
|
16
16
|
|
17
|
-
spec.metadata[
|
17
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
18
|
|
19
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
20
|
spec.metadata['source_code_uri'] = spec.homepage
|
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
33
|
spec.add_dependency 'faraday', '~> 2.7'
|
34
|
+
spec.add_dependency 'faraday-mashify', '~> 0.1'
|
35
|
+
spec.add_dependency 'hashie', '~> 5.0'
|
34
36
|
|
35
37
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
36
38
|
end
|
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: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-mashify
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
27
55
|
description: Wraps Relic APIs for easy access in Ruby. Current supports CoH3 stats/leaderboards
|
28
56
|
API.
|
29
57
|
email:
|
@@ -49,9 +77,11 @@ files:
|
|
49
77
|
- lib/relic_link/coh3/api/endpoints/matches.rb
|
50
78
|
- lib/relic_link/coh3/api/endpoints/stats.rb
|
51
79
|
- lib/relic_link/coh3/client.rb
|
80
|
+
- lib/relic_link/coh3/config.rb
|
52
81
|
- lib/relic_link/coh3/faraday/connection.rb
|
53
82
|
- lib/relic_link/coh3/util.rb
|
54
83
|
- lib/relic_link/faraday/request.rb
|
84
|
+
- lib/relic_link/logger.rb
|
55
85
|
- lib/relic_link/version.rb
|
56
86
|
- relic_link.gemspec
|
57
87
|
- sig/relic_link.rbs
|