Class: Stripe::SubscriptionSchedule
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::SubscriptionSchedule
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/subscription_schedule.rb
Overview
A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
Related guide: [Subscription schedules](stripe.com/docs/billing/subscriptions/subscription-schedules)
Constant Summary collapse
- OBJECT_NAME =
"subscription_schedule"
Constants inherited from StripeObject
Stripe::StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.cancel(schedule, params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription).
-
.create(params = {}, opts = {}) ⇒ Object
Creates a new subscription schedule object.
-
.list(params = {}, opts = {}) ⇒ Object
Retrieves the list of your subscription schedules.
- .object_name ⇒ Object
-
.release(schedule, params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place.
-
.update(id, params = {}, opts = {}) ⇒ Object
Updates an existing subscription schedule.
Instance Method Summary collapse
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription).
-
#release(params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Class Method Details
.cancel(schedule, params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
29 30 31 32 33 34 35 36 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 29 def self.cancel(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
39 40 41 42 43 44 45 46 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 39 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/subscription_schedules", params: params, opts: opts ) end |
.list(params = {}, opts = {}) ⇒ Object
Retrieves the list of your subscription schedules.
49 50 51 52 53 54 55 56 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 49 def self.list(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/subscription_schedules", params: params, opts: opts ) end |
.object_name ⇒ Object
14 15 16 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 14 def self.object_name "subscription_schedule" end |
.release(schedule, params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.
69 70 71 72 73 74 75 76 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 69 def self.release(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
.update(id, params = {}, opts = {}) ⇒ Object
Updates an existing subscription schedule.
79 80 81 82 83 84 85 86 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 79 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
19 20 21 22 23 24 25 26 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 19 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#release(params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.
59 60 61 62 63 64 65 66 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 59 def release(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }), params: params, opts: opts ) end |