relic_link 0.1.1 → 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 +1 -0
- data/README.md +2 -2
- 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 +1 -1
- data/lib/relic_link/logger.rb +20 -0
- data/lib/relic_link/version.rb +1 -1
- data/lib/relic_link.rb +4 -0
- metadata +4 -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
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/v0.1.
|
3
|
+
[](https://badge.fury.io/rb/relic_link) [](https://rubydoc.info/github/ryantaylor/relic_link/v0.1.2)
|
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/v0.1.
|
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!
|
33
33
|
|
34
34
|
## Contributing
|
35
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
|
@@ -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'
|
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
|
@@ -77,9 +77,11 @@ files:
|
|
77
77
|
- lib/relic_link/coh3/api/endpoints/matches.rb
|
78
78
|
- lib/relic_link/coh3/api/endpoints/stats.rb
|
79
79
|
- lib/relic_link/coh3/client.rb
|
80
|
+
- lib/relic_link/coh3/config.rb
|
80
81
|
- lib/relic_link/coh3/faraday/connection.rb
|
81
82
|
- lib/relic_link/coh3/util.rb
|
82
83
|
- lib/relic_link/faraday/request.rb
|
84
|
+
- lib/relic_link/logger.rb
|
83
85
|
- lib/relic_link/version.rb
|
84
86
|
- relic_link.gemspec
|
85
87
|
- sig/relic_link.rbs
|