Class: Apruve::Subscription
- Inherits:
-
OrderItem
- Object
- ApruveObject
- OrderItem
- Apruve::Subscription
- Defined in:
- lib/apruve/resources/subscription.rb
Instance Attribute Summary collapse
-
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
-
#end_at ⇒ Object
Returns the value of attribute end_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_charge_at ⇒ Object
Returns the value of attribute last_charge_at.
-
#next_charge_at ⇒ Object
Returns the value of attribute next_charge_at.
-
#start_at ⇒ Object
Returns the value of attribute start_at.
Attributes inherited from OrderItem
#description, #line_item_api_url, #merchant_notes, #plan_code, #price_ea_cents, #price_total_cents, #quantity, #sku, #subscription_url, #title, #variant_info, #vendor, #view_product_url
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from OrderItem
Methods inherited from ApruveObject
#initialize, logger, #logger, #to_hash, #to_json, #validate
Constructor Details
This class inherits a constructor from Apruve::ApruveObject
Instance Attribute Details
#canceled_at ⇒ Object
Returns the value of attribute canceled_at.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def canceled_at @canceled_at end |
#end_at ⇒ Object
Returns the value of attribute end_at.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def end_at @end_at end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def id @id end |
#last_charge_at ⇒ Object
Returns the value of attribute last_charge_at.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def last_charge_at @last_charge_at end |
#next_charge_at ⇒ Object
Returns the value of attribute next_charge_at.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def next_charge_at @next_charge_at end |
#start_at ⇒ Object
Returns the value of attribute start_at.
3 4 5 |
# File 'lib/apruve/resources/subscription.rb', line 3 def start_at @start_at end |
Class Method Details
.find(id) ⇒ Object
5 6 7 8 9 |
# File 'lib/apruve/resources/subscription.rb', line 5 def self.find(id) response = Apruve.get("subscriptions/#{id}") logger.debug response.body Subscription.new(response.body) end |
Instance Method Details
#cancel! ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/apruve/resources/subscription.rb', line 18 def cancel! response = Apruve.post("subscriptions/#{self.id}/cancel") logger.debug response.body self.canceled_at = Time.parse(response.body['canceled_at']) unless response.body['canceled_at'].nil? self.end_at = Time.parse(response.body['end_at']) unless response.body['end_at'].nil? nil end |