Module: Taric

Defined in:
lib/taric/operation/api.rb,
lib/taric.rb,
lib/taric/client.rb,
lib/taric/version.rb,
lib/taric/constants.rb,
lib/taric/connection.rb,
lib/taric/configuration.rb,
lib/taric/operation/base.rb,
lib/taric/operation/match.rb,
lib/taric/operation/runes.rb,
lib/taric/operation/league.rb,
lib/taric/operation/champion.rb,
lib/taric/operation/summoner.rb,
lib/taric/operation/masteries.rb,
lib/taric/operation/spectator.rb,
lib/taric/operation/lol_status.rb,
lib/taric/operation/lol_static_data.rb,
lib/taric/operation/champion_mastery.rb,
lib/taric/operation/endpoint_template.rb,
lib/taric/faraday_middleware/http_exception.rb

Overview

Combines operations of LoL API.

Defined Under Namespace

Modules: Connection, FaradayMiddleware, Operation Classes: Client, Configuration

Constant Summary collapse

VERSION =
'1.0.0'
RANKED_SOLO_5X5 =

rankedQueues

'RANKED_SOLO_5x5'.freeze
RANKED_TEAM_3X3 =
'RANKED_TEAM_3x3'.freeze
RANKED_TEAM_5X5 =
'RANKED_TEAM_5x5'.freeze
PRESEASON3 =

seasons

'PRESEASON3'.freeze
SEASON3 =
'SEASON3'.freeze
PRESEASON2014 =
'PRESEASON2014'.freeze
SEASON2014 =
'SEASON2014'.freeze
PRESEASON2015 =
'PRESEASON2015'.freeze
SEASON2015 =
'SEASON2015'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



9
10
11
# File 'lib/taric.rb', line 9

def configuration
  @configuration
end

Class Method Details

.client(region: :na, api_key: nil, config: @configuration ||= Taric::Configuration.new) ⇒ Taric::Client

Creates a [Taric::Client], the main interface to the LoL API. If the api_key is provided in .configure!, then only the region needs to be set. If .configure! is used, but a different api_key is provided, then the latter takes precedence.

Examples:

# With .configure! (preferred)
Taric.configure! do |config|
  config.api_key = 'your-rito-api-key'
end

client = Taric.client(region: :na)

# With arbitrary key.
client = Taric.client(region: :na, api_key: 'your-rito-key')

Parameters:

  • region (Symbol) (defaults to: :na)

    region code, also accepts [String], default is :na

  • api_key (String) (defaults to: nil)

    rito API key

  • config (Taric::Configuration) (defaults to: @configuration ||= Taric::Configuration.new)

    configuration options. If not provided, then defaults will be used.

Returns:

See Also:



32
33
34
35
36
# File 'lib/taric.rb', line 32

def client(region: :na, api_key: nil, config: @configuration ||= Taric::Configuration.new)
  Taric::Client.new(api_key: api_key || config.api_key,
                    region: region.is_a?(String) ? region.to_sym : region,
                    config: config)
end

.configure! {|configuration| ... } ⇒ Object

Sets global configuration. Should only be called once in a process (e.g. Rails initializer)

Examples:

Taric.configure! do |config|
  config.api_key = 'your_api_key'
end

Yields:

See Also:



46
47
48
49
# File 'lib/taric.rb', line 46

def configure!
  reset!
  yield(configuration)
end

.reset!Object

Resets global configuration.

See Also:



53
54
55
# File 'lib/taric.rb', line 53

def reset!
  @configuration = Taric::Configuration.new
end