Class: Apruve::SubscriptionAdjustment
- Inherits:
-
ApruveObject
- Object
- ApruveObject
- Apruve::SubscriptionAdjustment
- Defined in:
- lib/apruve/resources/subscription_adjustment.rb
Instance Attribute Summary collapse
-
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#merchant_notes ⇒ Object
Returns the value of attribute merchant_notes.
-
#price_ea_cents ⇒ Object
Returns the value of attribute price_ea_cents.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#sku ⇒ Object
Returns the value of attribute sku.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
-
#title ⇒ Object
Returns the value of attribute title.
-
#variant_info ⇒ Object
Returns the value of attribute variant_info.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
-
#view_product_url ⇒ Object
Returns the value of attribute view_product_url.
Class Method Summary collapse
- .delete(subscription_id, id) ⇒ Object
- .find(subscription_id, id) ⇒ Object
- .find_all(subscription_id) ⇒ Object
Instance Method Summary collapse
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
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def amount_cents @amount_cents end |
#api_url ⇒ Object
Returns the value of attribute api_url.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def api_url @api_url end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def id @id end |
#merchant_notes ⇒ Object
Returns the value of attribute merchant_notes.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def merchant_notes @merchant_notes end |
#price_ea_cents ⇒ Object
Returns the value of attribute price_ea_cents.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def price_ea_cents @price_ea_cents end |
#quantity ⇒ Object
Returns the value of attribute quantity.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def quantity @quantity end |
#sku ⇒ Object
Returns the value of attribute sku.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def sku @sku end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def status @status end |
#subscription_id ⇒ Object
Returns the value of attribute subscription_id.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def subscription_id @subscription_id end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def title @title end |
#variant_info ⇒ Object
Returns the value of attribute variant_info.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def variant_info @variant_info end |
#vendor ⇒ Object
Returns the value of attribute vendor.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def vendor @vendor end |
#view_product_url ⇒ Object
Returns the value of attribute view_product_url.
3 4 5 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 3 def view_product_url @view_product_url end |
Class Method Details
.delete(subscription_id, id) ⇒ Object
14 15 16 17 18 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 14 def self.delete(subscription_id, id) response = Apruve.delete("subscriptions/#{subscription_id}/adjustments/#{id}") logger.debug response.body nil end |
.find(subscription_id, id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 6 def self.find(subscription_id, id) response = Apruve.get("subscriptions/#{subscription_id}/adjustments/#{id}") logger.debug response.body found = SubscriptionAdjustment.new(response.body) found.subscription_id = subscription_id found end |
.find_all(subscription_id) ⇒ Object
20 21 22 23 24 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 20 def self.find_all(subscription_id) response = Apruve.get("subscriptions/#{subscription_id}/adjustments") logger.debug response.body SubscriptionAdjustment.new(response.body) end |
Instance Method Details
#delete! ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 35 def delete! if self.id == nil raise 'SubscriptionAdjustment has not been saved' else SubscriptionAdjustment.delete self.subscription_id, self.id end end |
#save! ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/apruve/resources/subscription_adjustment.rb', line 26 def save! validate response = Apruve.post("subscriptions/#{self.subscription_id}/adjustments", self.to_json) self.id = response.body['id'] self.status = response.body['status'] self.api_url = response.body['api_url'] self.status end |