Class: IActionable::Objects::ProfilePoints

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ ProfilePoints

Returns a new instance of ProfilePoints.



9
10
11
12
13
14
# File 'lib/iactionable/objects/profile_points.rb', line 9

def initialize(key_values={})
  levels = key_values.delete("Level")
  @level = IActionable::Objects::ProfileLevel.new(levels) unless levels.nil?
  @point_type = IActionable::Objects::PointType.new(key_values.delete("PointType"))
  super(key_values)
end

Instance Attribute Details

#levelObject

not always present



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

def level
  @level
end

#point_typeObject

Returns the value of attribute point_type.



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

def point_type
  @point_type
end

#pointsObject

Returns the value of attribute points.



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

def points
  @points
end

#reasonObject

not always present



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

def reason
  @reason
end

Instance Method Details

#to_hashObject



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

def to_hash
  hash = {
    "Level" => @level.nil? ? nil : @level.to_hash,
    "PointType" => @point_type.to_hash,
    "Points" => @points,
    "Reason" => @reason
  }
  hash.delete "Level" if @level.nil?
  hash.delete "Reason" if @reason.nil?
  hash
end