Class: Brawlhalla::API::Player
- Inherits:
-
Object
- Object
- Brawlhalla::API::Player
- Defined in:
- lib/brawlhalla/api/player.rb
Constant Summary collapse
- ATTRIBUTES =
%i[ brawlhalla_id name xp level xp_percentage games wins damagebomb damagespikeball damagesidekick hitsnowball kobomb komine kospikeball kosnowball ]
Instance Attribute Summary collapse
-
#clan ⇒ Object
readonly
Returns the value of attribute clan.
-
#legend_stats ⇒ Object
readonly
Returns the value of attribute legend_stats.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Player
constructor
A new instance of Player.
- #ranking ⇒ Object
Constructor Details
#initialize(json) ⇒ Player
Returns a new instance of Player.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/brawlhalla/api/player.rb', line 24 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 # Fix player name encoding @name = @name.encode('iso-8859-1') initialize_clan(json) initialize_legends(json) end |
Instance Attribute Details
#clan ⇒ Object (readonly)
Returns the value of attribute clan.
16 17 18 |
# File 'lib/brawlhalla/api/player.rb', line 16 def clan @clan end |
#legend_stats ⇒ Object (readonly)
Returns the value of attribute legend_stats.
16 17 18 |
# File 'lib/brawlhalla/api/player.rb', line 16 def legend_stats @legend_stats end |