Class: IActionable::Objects::ProfileNotifications

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ ProfileNotifications

Returns a new instance of ProfileNotifications.



10
11
12
13
14
15
16
# File 'lib/iactionable/objects/profile_notifications.rb', line 10

def initialize(key_values={})
  @achievements = IActionable::Objects::ProfileAchievements.new(key_values.delete("Achievements"))
  @challenges = IActionable::Objects::ProfileChallenges.new(key_values.delete("Challenges"))
  @goals = IActionable::Objects::ProfileGoals.new(key_values.delete("Goals"))
  @levels = extract_many_as(key_values, "Levels", IActionable::Objects::Level)
  @points = extract_many_as(key_values, "Points", IActionable::Objects::ProfilePoints)
end

Instance Attribute Details

#achievementsObject

Returns the value of attribute achievements.



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

def achievements
  @achievements
end

#challengesObject

Returns the value of attribute challenges.



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

def challenges
  @challenges
end

#goalsObject

Returns the value of attribute goals.



6
7
8
# File 'lib/iactionable/objects/profile_notifications.rb', line 6

def goals
  @goals
end

#levelsObject

Returns the value of attribute levels.



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

def levels
  @levels
end

#pointsObject

Returns the value of attribute points.



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

def points
  @points
end

Instance Method Details

#to_hashObject



18
19
20
21
22
23
24
25
26
# File 'lib/iactionable/objects/profile_notifications.rb', line 18

def to_hash
  {
    "Achievements" => @achievements.to_hash,
    "Challenges" => @challenges.to_hash,
    "Goals" => @goals.to_hash,
    "Levels" => @levels.map{|level| level.to_hash},
    "Points" => @points.map{|point| point.to_hash}
  }
end