Class: Rito::League

Inherits:
ApiBase show all
Defined in:
lib/rito/league.rb

Defined Under Namespace

Classes: Entry, MiniSeries

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiBase

#attributes=, call_api, from_list, from_map, from_map_of_lists

Constructor Details

#initialize(attributes = {}) ⇒ League

Returns a new instance of League


5
6
7
8
# File 'lib/rito/league.rb', line 5

def initialize(attributes = {})
	self.entries = Rito::League::Entry.from_list(attributes.delete('entries')) if attributes['entries']
	super
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries


3
4
5
# File 'lib/rito/league.rb', line 3

def entries
  @entries
end

#nameObject

Returns the value of attribute name


3
4
5
# File 'lib/rito/league.rb', line 3

def name
  @name
end

#participantIdObject

Returns the value of attribute participantId


3
4
5
# File 'lib/rito/league.rb', line 3

def participantId
  @participantId
end

#queueObject

Returns the value of attribute queue


3
4
5
# File 'lib/rito/league.rb', line 3

def queue
  @queue
end

#tierObject

Returns the value of attribute tier


3
4
5
# File 'lib/rito/league.rb', line 3

def tier
  @tier
end

Class Method Details

.by_summoner_id(summoner_ids) ⇒ Object


11
12
13
14
15
16
# File 'lib/rito/league.rb', line 11

def by_summoner_id(summoner_ids)
	summoner_ids = [summoner_ids] unless summoner_ids.is_a? Array
	url = league_url + "/by-summoner/#{summoner_ids.join(',')}"
	response = call_api(url)
	from_map_of_lists(response)
end

.by_team_id(team_ids) ⇒ Object


25
26
27
28
29
30
# File 'lib/rito/league.rb', line 25

def by_team_id(team_ids)
	team_ids = [team_ids] unless team_ids.is_a? Array
	url = league_url + "/by-team/#{team_ids.join(',')}"
	response = call_api(url)
	from_map_of_lists(response)
end

.challenger_tier(queue_type) ⇒ Object


39
40
41
42
43
44
# File 'lib/rito/league.rb', line 39

def challenger_tier(queue_type)
	params = { 'type' => queue_type }
	url = league_url + "/challenger"
	response = call_api(url)
	new(response)
end

.entry_by_summoner_id(summoner_ids) ⇒ Object


18
19
20
21
22
23
# File 'lib/rito/league.rb', line 18

def entry_by_summoner_id(summoner_ids)
	summoner_ids = [summoner_ids] unless summoner_ids.is_a? Array
	url = league_url + "/by-summoner/#{summoner_ids.join(',')}/entry"
	response = call_api(url)
	from_map_of_lists(response)
end

.entry_by_team_id(team_ids) ⇒ Object


32
33
34
35
36
37
# File 'lib/rito/league.rb', line 32

def entry_by_team_id(team_ids)
	team_ids = [team_ids] unless team_ids.is_a? Array
	url = league_url + "/by-team/#{team_ids.join(',')}/entry"
	response = call_api(url)
	from_map_of_lists(response)
end

.league_urlObject


46
47
48
# File 'lib/rito/league.rb', line 46

def league_url
	Rito.root_url + "/api/lol/#{Rito.region}/v2.5/league"
end