Class: Lolxin::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/lolxin/client.rb

Overview

Client create connection clients for specific endpoints

Constant Summary collapse

ENDPOINTS =
[
  :champion_mastery,
  :champion,
  :league,
  :lol_static_data,
  :lol_status,
  :match,
  :spectator,
  :summoner,
  :third_party_code
  #tournament_stub
  #tournament
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, options = {}) ⇒ Client

Returns a new instance of Client.

Raises:



22
23
24
25
26
27
28
# File 'lib/lolxin/client.rb', line 22

def initialize(api_key, options = {})
  @api_key = api_key
  @region  = options[:region] if Region.valid?(options[:region])
  @options = { api_key: @api_key, region: @region }
  raise ClientError, "Invalid API key" if @api_key.nil? || @api_key.empty?
  raise ClientError, "Invalid region" unless @region
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



20
21
22
# File 'lib/lolxin/client.rb', line 20

def api_key
  @api_key
end

#optionsObject (readonly)

Returns the value of attribute options.



20
21
22
# File 'lib/lolxin/client.rb', line 20

def options
  @options
end

#regionObject (readonly)

Returns the value of attribute region.



20
21
22
# File 'lib/lolxin/client.rb', line 20

def region
  @region
end