Class: IActionable::Objects::ProfileAchievements

Inherits:
IActionableObject show all
Defined in:
lib/iactionable/objects/profile_achievements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ ProfileAchievements

Returns a new instance of ProfileAchievements.



7
8
9
10
# File 'lib/iactionable/objects/profile_achievements.rb', line 7

def initialize(key_values={})
  @available = extract_many_as(key_values, "Available", IActionable::Objects::Achievement)
  @completed = extract_many_as(key_values, "Completed", IActionable::Objects::Achievement)
end

Instance Attribute Details

#availableObject

Returns the value of attribute available.



4
5
6
# File 'lib/iactionable/objects/profile_achievements.rb', line 4

def available
  @available
end

#completedObject

Returns the value of attribute completed.



5
6
7
# File 'lib/iactionable/objects/profile_achievements.rb', line 5

def completed
  @completed
end

Instance Method Details

#to_hashObject



12
13
14
15
16
17
# File 'lib/iactionable/objects/profile_achievements.rb', line 12

def to_hash
  {
    "Available" => @available.map{|achievement| achievement.to_hash},
    "Completed" => @completed.map{|achievement| achievement.to_hash}
  }
end