Class: IActionable::Objects::ProfileChallenges

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ ProfileChallenges

Returns a new instance of ProfileChallenges.



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

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

Instance Attribute Details

#availableObject

Returns the value of attribute available.



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

def available
  @available
end

#completedObject

Returns the value of attribute completed.



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

def completed
  @completed
end

Instance Method Details

#to_hashObject



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

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