Class: RubyGg::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, region = 'na') ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ruby_gg/client.rb', line 9

def initialize(api_key, region = 'na')
    @api_key = api_key
    region_tag = { :na => 'na1', 
                    :eune => 'eun1', 
                    :euw => 'euw1',
                    :jp => 'jp1',
                    :kr => 'kr',
                    :lan => 'la1',
                    :las => 'la2',
                    :br => 'br1',
                    :oce => 'oc1',
                    :tr => 'tr1',
                    :ru => 'ru',
                    :pbe => 'pbe1' }
    @region = region_tag[region.to_sym]
    @base_url = "https://#{@region}.api.riotgames.com"
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



6
7
8
# File 'lib/ruby_gg/client.rb', line 6

def api_key
  @api_key
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



8
9
10
# File 'lib/ruby_gg/client.rb', line 8

def base_url
  @base_url
end

#regionObject

Returns the value of attribute region.



7
8
9
# File 'lib/ruby_gg/client.rb', line 7

def region
  @region
end

Instance Method Details

#challengerObject



27
28
29
# File 'lib/ruby_gg/client.rb', line 27

def challenger
    @challenger = Challenger.new(@api_key, @region)
end

#summonerObject



31
32
33
# File 'lib/ruby_gg/client.rb', line 31

def summoner
    @summoner = Summoner.new(@api_key, @region)
end