Class: Wot::Player::Achievement
- Inherits:
-
Object
- Object
- Wot::Player::Achievement
- Defined in:
- lib/wot/player/achievement.rb
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#max ⇒ Object
Returns the value of attribute max.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, current, max = nil) ⇒ Achievement
constructor
A new instance of Achievement.
Constructor Details
#initialize(name, current, max = nil) ⇒ Achievement
Returns a new instance of Achievement.
19 20 21 22 23 |
# File 'lib/wot/player/achievement.rb', line 19 def initialize(name, current, max = nil) @name = name @current = current @max = max end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
6 7 8 |
# File 'lib/wot/player/achievement.rb', line 6 def current @current end |
#max ⇒ Object
Returns the value of attribute max.
6 7 8 |
# File 'lib/wot/player/achievement.rb', line 6 def max @max end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/wot/player/achievement.rb', line 6 def name @name end |
Class Method Details
.get_achievements(player, api) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/wot/player/achievement.rb', line 8 def self.get_achievements(player,api) achievements = [] response = api.player_achievements(player.id) data = response[:data][player.id.to_s] names = data[:achievements].keys + data[:max_series].keys names.each do |name| achievements << Wot::Player::Achievement.new(name,data[:achievements][name],data[:max_series][name]) end return achievements end |