Class: LolApi::Match

Inherits:
HistoryMatch show all
Defined in:
lib/lol_api/types/match.rb

Instance Attribute Summary

Attributes inherited from HistoryMatch

#raw_match

Instance Method Summary collapse

Methods inherited from HistoryMatch

#initialize, #map_id, #match_creation, #match_duration, #match_id, #match_version, #participant_identities, #participants, #queue_type, #region, #season

Constructor Details

This class inherits a constructor from LolApi::HistoryMatch

Instance Method Details

#blue_teamObject



25
26
27
# File 'lib/lol_api/types/match.rb', line 25

def blue_team 
	[ teams[0], participants.select { |x| x.team_id == 100 } ]
end

#match_modeObject



11
12
13
# File 'lib/lol_api/types/match.rb', line 11

def match_mode
	raw_match['matchMode']
end

#match_typeObject



7
8
9
# File 'lib/lol_api/types/match.rb', line 7

def match_type
	raw_match['matchType']
end

#purple_teamObject



29
30
31
# File 'lib/lol_api/types/match.rb', line 29

def purple_team
	[ teams[1], participants.select { |x| x.team_id == 200 } ]
end

#teamsObject



15
16
17
18
19
# File 'lib/lol_api/types/match.rb', line 15

def teams
	if teams = raw_match['teams']
		teams.map { |e| Team.new(e) }
	end
end

#timelineObject



21
22
23
# File 'lib/lol_api/types/match.rb', line 21

def timeline
	Timeline.new(raw_match['timeline'])
end

#ward_placementsObject



33
34
35
36
37
38
39
# File 'lib/lol_api/types/match.rb', line 33

def ward_placements
	timeline.frames.map do |f|
		f.events.select do |e|
			e.event_type == "WARD_PLACED"
		end
	end.flatten
end