Class: Rito::RecentGames

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

Defined Under Namespace

Classes: Game, Player, RawStats

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 = {}) ⇒ RecentGames


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

def initialize(attributes = {})
	self.games = Rito::RecentGames::Game.from_list(attributes.delete('games')) if attributes['games']
	super
end

Instance Attribute Details

#gamesObject

Returns the value of attribute games


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

def games
  @games
end

#summonerIdObject

Returns the value of attribute summonerId


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

def summonerId
  @summonerId
end

Class Method Details

.by_summoner_id(summoner_id) ⇒ Object


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

def by_summoner_id(summoner_id)
	url = recent_games_url + "/#{summoner_id}/recent"
	response = call_api(url)
	self.new(response)
end

.recent_games_urlObject


17
18
19
# File 'lib/rito/recent_games.rb', line 17

def recent_games_url
	Rito.root_url + "/api/lol/#{Rito.region}/v1.3/game/by-summoner"
end