Class: Stripe::SubscriptionItemService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::SubscriptionItemService
- Defined in:
- lib/stripe/services/subscription_item_service.rb
Instance Attribute Summary collapse
-
#usage_record_summaries ⇒ Object
readonly
Returns the value of attribute usage_record_summaries.
-
#usage_records ⇒ Object
readonly
Returns the value of attribute usage_records.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Adds a new item to an existing subscription.
-
#delete(item, params = {}, opts = {}) ⇒ Object
Deletes an item from the subscription.
-
#initialize(requestor) ⇒ SubscriptionItemService
constructor
A new instance of SubscriptionItemService.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your subscription items for a given subscription.
-
#retrieve(item, params = {}, opts = {}) ⇒ Object
Retrieves the subscription item with the given ID.
-
#update(item, params = {}, opts = {}) ⇒ Object
Updates the plan or quantity of an item on a current subscription.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ SubscriptionItemService
Returns a new instance of SubscriptionItemService.
8 9 10 11 12 |
# File 'lib/stripe/services/subscription_item_service.rb', line 8 def initialize(requestor) super(requestor) @usage_records = Stripe::SubscriptionItemUsageRecordService.new(@requestor) @usage_record_summaries = Stripe::SubscriptionItemUsageRecordSummaryService.new(@requestor) end |
Instance Attribute Details
#usage_record_summaries ⇒ Object (readonly)
Returns the value of attribute usage_record_summaries.
6 7 8 |
# File 'lib/stripe/services/subscription_item_service.rb', line 6 def usage_record_summaries @usage_record_summaries end |
#usage_records ⇒ Object (readonly)
Returns the value of attribute usage_records.
6 7 8 |
# File 'lib/stripe/services/subscription_item_service.rb', line 6 def usage_records @usage_records end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Adds a new item to an existing subscription. No existing items will be changed or replaced.
15 16 17 18 19 20 21 22 23 |
# File 'lib/stripe/services/subscription_item_service.rb', line 15 def create(params = {}, opts = {}) request( method: :post, path: "/v1/subscription_items", params: params, opts: opts, base_address: :api ) end |
#delete(item, params = {}, opts = {}) ⇒ Object
Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
26 27 28 29 30 31 32 33 34 |
# File 'lib/stripe/services/subscription_item_service.rb', line 26 def delete(item, params = {}, opts = {}) request( method: :delete, path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }), params: params, opts: opts, base_address: :api ) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of your subscription items for a given subscription.
37 38 39 40 41 42 43 44 45 |
# File 'lib/stripe/services/subscription_item_service.rb', line 37 def list(params = {}, opts = {}) request( method: :get, path: "/v1/subscription_items", params: params, opts: opts, base_address: :api ) end |
#retrieve(item, params = {}, opts = {}) ⇒ Object
Retrieves the subscription item with the given ID.
48 49 50 51 52 53 54 55 56 |
# File 'lib/stripe/services/subscription_item_service.rb', line 48 def retrieve(item, params = {}, opts = {}) request( method: :get, path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }), params: params, opts: opts, base_address: :api ) end |
#update(item, params = {}, opts = {}) ⇒ Object
Updates the plan or quantity of an item on a current subscription.
59 60 61 62 63 64 65 66 67 |
# File 'lib/stripe/services/subscription_item_service.rb', line 59 def update(item, params = {}, opts = {}) request( method: :post, path: format("/v1/subscription_items/%<item>s", { item: CGI.escape(item) }), params: params, opts: opts, base_address: :api ) end |