Class: Orb::Resources::SubscriptionChanges
- Inherits:
-
Object
- Object
- Orb::Resources::SubscriptionChanges
- Defined in:
- lib/orb/resources/subscription_changes.rb
Instance Method Summary collapse
-
#apply(subscription_change_id, description: nil, previously_collected_amount: nil, request_options: {}) ⇒ Orb::Models::SubscriptionChangeApplyResponse
Apply a subscription change to perform the intended action.
-
#cancel(subscription_change_id, request_options: {}) ⇒ Orb::Models::SubscriptionChangeCancelResponse
Cancel a subscription change.
-
#initialize(client:) ⇒ SubscriptionChanges
constructor
private
A new instance of SubscriptionChanges.
-
#retrieve(subscription_change_id, request_options: {}) ⇒ Orb::Models::SubscriptionChangeRetrieveResponse
This endpoint returns a subscription change given an identifier.
Constructor Details
#initialize(client:) ⇒ SubscriptionChanges
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SubscriptionChanges.
85 86 87 |
# File 'lib/orb/resources/subscription_changes.rb', line 85 def initialize(client:) @client = client end |
Instance Method Details
#apply(subscription_change_id, description: nil, previously_collected_amount: nil, request_options: {}) ⇒ Orb::Models::SubscriptionChangeApplyResponse
Apply a subscription change to perform the intended action. If a positive amount is passed with a request to this endpoint, any eligible invoices that were created will be issued immediately if they only contain in-advance fees.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/orb/resources/subscription_changes.rb', line 50 def apply(subscription_change_id, params = {}) parsed, = Orb::SubscriptionChangeApplyParams.dump_request(params) @client.request( method: :post, path: ["subscription_changes/%1$s/apply", subscription_change_id], body: parsed, model: Orb::Models::SubscriptionChangeApplyResponse, options: ) end |
#cancel(subscription_change_id, request_options: {}) ⇒ Orb::Models::SubscriptionChangeCancelResponse
Cancel a subscription change. The change can no longer be applied. A subscription can only have one “pending” change at a time - use this endpoint to cancel an existing change before creating a new one.
73 74 75 76 77 78 79 80 |
# File 'lib/orb/resources/subscription_changes.rb', line 73 def cancel(subscription_change_id, params = {}) @client.request( method: :post, path: ["subscription_changes/%1$s/cancel", subscription_change_id], model: Orb::Models::SubscriptionChangeCancelResponse, options: params[:request_options] ) end |
#retrieve(subscription_change_id, request_options: {}) ⇒ Orb::Models::SubscriptionChangeRetrieveResponse
This endpoint returns a subscription change given an identifier.
A subscription change is created by including ‘Create-Pending-Subscription-Change: True` in the header of a subscription mutation API call (e.g. [create subscription endpoint](/api-reference/subscription/create-subscription), [schedule plan change endpoint](/api-reference/subscription/schedule-plan-change), …). The subscription change will be referenced by the `pending_subscription_change` field in the response.
24 25 26 27 28 29 30 31 |
# File 'lib/orb/resources/subscription_changes.rb', line 24 def retrieve(subscription_change_id, params = {}) @client.request( method: :get, path: ["subscription_changes/%1$s", subscription_change_id], model: Orb::Models::SubscriptionChangeRetrieveResponse, options: params[:request_options] ) end |