Class: Tiltify::Reward

Inherits:
Object
  • Object
show all
Defined in:
lib/tiltify/objects/reward.rb

Instance Method Summary collapse

Methods inherited from Object

#to_ostruct

Constructor Details

#initialize(options = {}) ⇒ Reward

Returns a new instance of Reward.



4
5
6
7
8
9
10
11
12
13
# File 'lib/tiltify/objects/reward.rb', line 4

def initialize(options = {})
  super options

  self.retired_at     = Time.at(options["retiredAt"].to_s[0..-4].to_i) if options["retiredAt"]
  self.activated_at   = Time.at(options["activatedAt"].to_s[0..-4].to_i) if options["activatedAt"]
  self.deactivated_at = Time.at(options["deactivatedAt"].to_s[0..-4].to_i) if options["deactivatedAt"]
  self.ends_at        = Time.at(options["endsAt"].to_s[0..-4].to_i) if options["endsAt"]
  self.created_at     = Time.at(options["createdAt"].to_s[0..-4].to_i) if options["createdAt"]
  self.updated_at     = Time.at(options["updatedAt"].to_s[0..-4].to_i) if options["updatedAt"]
end