Class: Tarpon::Entity::Entitlement

Inherits:
Object
  • Object
show all
Defined in:
lib/tarpon/entity/entitlement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, attributes = {}) ⇒ Entitlement

Returns a new instance of Entitlement.



8
9
10
11
# File 'lib/tarpon/entity/entitlement.rb', line 8

def initialize(id, attributes = {})
  @id  = id
  @raw = attributes
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/tarpon/entity/entitlement.rb', line 6

def id
  @id
end

#rawObject (readonly)

Returns the value of attribute raw.



6
7
8
# File 'lib/tarpon/entity/entitlement.rb', line 6

def raw
  @raw
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/tarpon/entity/entitlement.rb', line 13

def active?
  expires_date > Time.now.utc
end

#expires_dateObject



17
18
19
# File 'lib/tarpon/entity/entitlement.rb', line 17

def expires_date
  Time.iso8601(@raw[:expires_date])
end

#purchase_dateObject



21
22
23
# File 'lib/tarpon/entity/entitlement.rb', line 21

def purchase_date
  Time.iso8601(@raw[:purchase_date])
end