Class: RecentGames

Inherits:
Object
  • Object
show all
Defined in:
lib/LoLStat/RecentGames.rb

Defined Under Namespace

Classes: Game

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(summonerId, api_key) ⇒ RecentGames

Returns a new instance of RecentGames.



3
4
5
6
# File 'lib/LoLStat/RecentGames.rb', line 3

def initialize(summonerId, api_key)
	@URI = "https://prod.api.pvp.net/api/lol/na/v1.1/game/by-summoner/" + summonerId.to_s + "/recent" + "?api_key=" + api_key.to_s
	@data = JSON.parse(Net::HTTP.get_response(URI.parse(@URI)).body)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



2
3
4
# File 'lib/LoLStat/RecentGames.rb', line 2

def data
  @data
end

Instance Method Details

#getGame(game_num) ⇒ Object



7
8
9
# File 'lib/LoLStat/RecentGames.rb', line 7

def getGame(game_num)
	return Game.new(@data, game_num)
end