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.



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

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.



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

def api_key
  @api_key
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



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

def base_url
  @base_url
end

#regionObject

Returns the value of attribute region.



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

def region
  @region
end

Instance Method Details

#challengerObject



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

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

#championObject



36
37
38
# File 'lib/ruby_gg/client.rb', line 36

def champion
    @champion = Champion.new(@api_key, @region)
end

#summonerObject



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

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