Class: Rito::CurrentGame

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

Defined Under Namespace

Classes: BannedChampion, Mastery, Observer, Participant, Rune

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

Returns a new instance of CurrentGame


15
16
17
18
19
20
# File 'lib/rito/current_game.rb', line 15

def initialize(attributes = {})
	self.bannedChampions = Rito::CurrentGame::BannedChampion.from_list(attributes.delete('bannedChampions')) if attributes['bannedChampions']
	self.observers = Rito::CurrentGame::Observer.new(attributes.delete('observers')) if attributes['observers']
	self.participants = Rito::CurrentGame::Participant.from_list(attributes.delete('participants')) if attributes['participants']
	super
end

Instance Attribute Details

#bannedChampionsObject

Returns the value of attribute bannedChampions


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

def bannedChampions
  @bannedChampions
end

#gameIdObject

Returns the value of attribute gameId


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

def gameId
  @gameId
end

#gameLengthObject

Returns the value of attribute gameLength


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

def gameLength
  @gameLength
end

#gameModeObject

Returns the value of attribute gameMode


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

def gameMode
  @gameMode
end

#gameQueueConfigIdObject

Returns the value of attribute gameQueueConfigId


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

def gameQueueConfigId
  @gameQueueConfigId
end

#gameStartTimeObject

Returns the value of attribute gameStartTime


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

def gameStartTime
  @gameStartTime
end

#gameTypeObject

Returns the value of attribute gameType


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

def gameType
  @gameType
end

#mapIdObject

Returns the value of attribute mapId


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

def mapId
  @mapId
end

#observersObject

Returns the value of attribute observers


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

def observers
  @observers
end

#participantsObject

Returns the value of attribute participants


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

def participants
  @participants
end

#platformIdObject

Returns the value of attribute platformId


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

def platformId
  @platformId
end

Class Method Details

.by_summoner_id(summoner_id) ⇒ Object


23
24
25
26
27
# File 'lib/rito/current_game.rb', line 23

def by_summoner_id(summoner_id)
	url = current_game_url + "/#{summoner_id}"
	response = call_api(url)
	new(response)
end

.current_game_urlObject


29
30
31
# File 'lib/rito/current_game.rb', line 29

def current_game_url
	Rito.root_url + "/observer-mode/rest/consumer/getSpectatorGameInfo/#{Rito.platform}"
end