Class: IActionable::Objects::ProfileSummary
- Inherits:
-
IActionableObject
- Object
- IActionableObject
- IActionable::Objects::ProfileSummary
- Defined in:
- lib/iactionable/objects/profile_summary.rb
Instance Attribute Summary collapse
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#identifiers ⇒ Object
Returns the value of attribute identifiers.
-
#points ⇒ Object
Returns the value of attribute points.
-
#rank ⇒ Object
not always present.
-
#recent_achievements ⇒ Object
not always present.
Instance Method Summary collapse
-
#initialize(key_values = {}) ⇒ ProfileSummary
constructor
A new instance of ProfileSummary.
- #to_hash ⇒ Object
Methods inherited from IActionableObject
timestamp_regexp, timestamp_to_seconds
Constructor Details
#initialize(key_values = {}) ⇒ ProfileSummary
Returns a new instance of ProfileSummary.
10 11 12 13 14 15 16 |
# File 'lib/iactionable/objects/profile_summary.rb', line 10 def initialize(key_values={}) @identifiers = extract_many_as(key_values, "Identifiers", IActionable::Objects::Identifier) @points = extract_many_as(key_values, "Points", IActionable::Objects::ProfilePoints) @recent_achievements = extract_many_as(key_values, "RecentAchievements", IActionable::Objects::Achievement) super(key_values) end |
Instance Attribute Details
#display_name ⇒ Object
Returns the value of attribute display_name.
4 5 6 |
# File 'lib/iactionable/objects/profile_summary.rb', line 4 def display_name @display_name end |
#identifiers ⇒ Object
Returns the value of attribute identifiers.
5 6 7 |
# File 'lib/iactionable/objects/profile_summary.rb', line 5 def identifiers @identifiers end |
#points ⇒ Object
Returns the value of attribute points.
6 7 8 |
# File 'lib/iactionable/objects/profile_summary.rb', line 6 def points @points end |
#rank ⇒ Object
not always present
8 9 10 |
# File 'lib/iactionable/objects/profile_summary.rb', line 8 def rank @rank end |
#recent_achievements ⇒ Object
not always present
7 8 9 |
# File 'lib/iactionable/objects/profile_summary.rb', line 7 def recent_achievements @recent_achievements end |
Instance Method Details
#to_hash ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/iactionable/objects/profile_summary.rb', line 18 def to_hash hash = { "DisplayName" => @display_name, "Identifiers" => @identifiers.map{|identifier| identifier.to_hash} } unless @points.nil? hash["Points"] = @points.kind_of?(Array) ? @points.map{|point| point.to_hash} : @points end hash["RecentAchievements"] = @recent_achievements.map{|recent_achievement| recent_achievement.to_hash} unless @recent_achievements.empty? hash["Rank"] = @rank unless @rank.nil? hash end |