Class: Tarpon::Entity::Entitlement
- Inherits:
-
Object
- Object
- Tarpon::Entity::Entitlement
- Defined in:
- lib/tarpon/entity/entitlement.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #expires_date ⇒ Object
-
#initialize(id, attributes = {}) ⇒ Entitlement
constructor
A new instance of Entitlement.
- #purchase_date ⇒ Object
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
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/tarpon/entity/entitlement.rb', line 6 def id @id end |
#raw ⇒ Object (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
13 14 15 |
# File 'lib/tarpon/entity/entitlement.rb', line 13 def active? expires_date > Time.now.utc end |
#expires_date ⇒ Object
17 18 19 |
# File 'lib/tarpon/entity/entitlement.rb', line 17 def expires_date Time.iso8601(@raw[:expires_date]) end |
#purchase_date ⇒ Object
21 22 23 |
# File 'lib/tarpon/entity/entitlement.rb', line 21 def purchase_date Time.iso8601(@raw[:purchase_date]) end |