Class: Brawlhalla::API::LegendStat

Inherits:
Object
  • Object
show all
Defined in:
lib/brawlhalla/api/legend_stat.rb

Constant Summary collapse

ATTRIBUTES =
i[
  legend_id legend_name_key damagedealt damagetaken kos falls suicides teamkos matchtime games
  wins damageunarmed damagethrownitem damageweaponone damageweapontwo damagegadgets kounarmed
  kothrownitem koweaponone koweapontwo kogadgets timeheldweaponone timeheldweapontwo xp level
  xp_percentage
]

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ LegendStat

Returns a new instance of LegendStat.



15
16
17
18
19
20
21
22
# File 'lib/brawlhalla/api/legend_stat.rb', line 15

def initialize(json)
  ATTRIBUTES.each do |attr|
    value = json[attr]
    value = value.to_i if attr.to_s.start_with?('damage')

    send("#{attr}=", value)
  end
end