Class: IActionable::Objects::Goal

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from IActionableObject

timestamp_regexp, timestamp_to_seconds

Constructor Details

#initialize(key_values = {}) ⇒ Goal

Returns a new instance of Goal.



11
12
13
14
# File 'lib/iactionable/objects/goal.rb', line 11

def initialize(key_values={})
  initialize_awardable(key_values)
  super(key_values)
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#intervalObject

Returns the value of attribute interval.



9
10
11
# File 'lib/iactionable/objects/goal.rb', line 9

def interval
  @interval
end

#keyObject

Returns the value of attribute key.



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

def key
  @key
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#to_hashObject



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

def to_hash
  hash = {
    "Key" => @key,
    "Description" => @description,
    "Name" => @name,
    "Interval" => @interval
  }
  hash.merge!(awardable_hash) unless @progress.empty?
  hash.delete("AwardDate") if @award_date.nil?
  hash.delete("Interval") if @interval.nil?
  hash
end