Class: RelicLink::Coh3::Client

Inherits:
Object
  • Object
show all
Includes:
Api::Endpoints, Faraday::Connection, Util, Faraday::Request
Defined in:
lib/relic_link/coh3/client.rb

Overview

Main entrypoint for the CoH3 API. Create a new instance of this class in order to begin querying the CoH3 API.

Examples:

client = RelicLink::Coh3::Client.new
client.available_leaderboards

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Util

#array_params

Methods included from Api::Endpoints::Stats

#personal_stats

Methods included from Api::Endpoints::Replays

#replay_url

Methods included from Api::Endpoints::Matches

#recent_match_history, #recent_match_history_by_profile_id

Methods included from Api::Endpoints::Leaderboards

#available_leaderboards, #leaderboard

Methods included from Faraday::Request

#get

Constructor Details

#initialize(options = {}) ⇒ Client

Initializes a new client.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :logger (Logger)

    Instance of a logging class. If not provided, defaults to STDOUT at Logging::WARN.



25
26
27
28
29
30
# File 'lib/relic_link/coh3/client.rb', line 25

def initialize(options = {})
  RelicLink::Coh3::Config::ATTRIBUTES.each do |key|
    send("#{key}=", options.fetch(key, RelicLink::Coh3.config.send(key)))
  end
  @logger ||= RelicLink::Coh3::Config.logger || RelicLink::Logger.default
end

Class Method Details

.configObject

Current config module.



40
41
42
# File 'lib/relic_link/coh3/client.rb', line 40

def config
  RelicLink::Coh3::Config
end

.configureObject

Set configuration options. Can be set on the returned object directly or in a block.



35
36
37
# File 'lib/relic_link/coh3/client.rb', line 35

def configure
  block_given? ? yield(RelicLink::Coh3::Config) : RelicLink::Coh3::Config
end