Class: Brawlhalla::API::Ranking
- Inherits:
-
Object
- Object
- Brawlhalla::API::Ranking
- Defined in:
- lib/brawlhalla/api/ranking.rb
Constant Summary collapse
- ATTRIBUTES =
%i[ name brawlhalla_id rating peak_rating tier wins games region global_rank region_rank ]
Instance Attribute Summary collapse
-
#doubles_rankings ⇒ Object
readonly
Returns the value of attribute doubles_rankings.
-
#legend_rankings ⇒ Object
readonly
Returns the value of attribute legend_rankings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Ranking
constructor
A new instance of Ranking.
Constructor Details
#initialize(json) ⇒ Ranking
Returns a new instance of Ranking.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/brawlhalla/api/ranking.rb', line 21 def initialize(json) ATTRIBUTES.each do |attr| send("#{attr}=", json[attr]) end legends = json[:legends] || [] doubles = json[:"2v2"] || [] @legend_rankings = legends.map { |legend_json| LegendRanking.new(legend_json) } @doubles_rankings = doubles.map { |doubles_json| DoublesRanking.new(doubles_json) } end |
Instance Attribute Details
#doubles_rankings ⇒ Object (readonly)
Returns the value of attribute doubles_rankings.
14 15 16 |
# File 'lib/brawlhalla/api/ranking.rb', line 14 def doubles_rankings @doubles_rankings end |
#legend_rankings ⇒ Object (readonly)
Returns the value of attribute legend_rankings.
14 15 16 |
# File 'lib/brawlhalla/api/ranking.rb', line 14 def legend_rankings @legend_rankings end |