class Dota::API::Match::Player

Constants

SLOT_GAP

See wiki.teamfortress.com/wiki/WebAPI/GetMatchHistory#Player_Slot

Public Instance Methods

ability_upgrades() click to toggle source
# File lib/dota/api/match/player.rb, line 44
def ability_upgrades
  raw["ability_upgrades"] ?
    raw["ability_upgrades"].map { |ability_upgrade| AbilityUpgrade.new(ability_upgrade) } :
    []
end
additional_units() click to toggle source
# File lib/dota/api/match/player.rb, line 38
def additional_units
  raw["additional_units"] ?
    raw["additional_units"].map { |unit| Unit.new(unit["unitname"], extract_items_from(unit)) } :
    []
end
deaths() click to toggle source
# File lib/dota/api/match/player.rb, line 18
def deaths
  raw["deaths"]
end
gold_spent() click to toggle source
# File lib/dota/api/match/player.rb, line 22
def gold_spent
  raw["gold_spent"]
end
hero_damage() click to toggle source
# File lib/dota/api/match/player.rb, line 26
def hero_damage
  raw["hero_damage"]
end
hero_healing() click to toggle source
# File lib/dota/api/match/player.rb, line 34
def hero_healing
  raw["hero_healing"]
end
items() click to toggle source
# File lib/dota/api/match/player.rb, line 50
def items
  extract_items_from raw
end
slot() click to toggle source
# File lib/dota/api/match/player.rb, line 8
def slot
  slot = raw["player_slot"]
  slot -= SLOT_GAP if slot >= SLOT_GAP
  slot + 1
end
status() click to toggle source
# File lib/dota/api/match/player.rb, line 14
def status
  STATUS[raw["leaver_status"]]
end
tower_damage() click to toggle source
# File lib/dota/api/match/player.rb, line 30
def tower_damage
  raw["tower_damage"]
end

Private Instance Methods

extract_items_from(obj) click to toggle source
# File lib/dota/api/match/player.rb, line 56
def extract_items_from(obj)
  (0..5).map { |i| Item.new(obj["item_#{i}"]) }
end