Class: Stripe::SubscriptionScheduleService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/subscription_schedule_service.rb

Defined Under Namespace

Classes: AmendParams, CancelParams, CreateParams, ListParams, ReleaseParams, RetrieveParams, UpdateParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#amend(schedule, params = {}, opts = {}) ⇒ Object

Amends an existing subscription schedule.



2053
2054
2055
2056
2057
2058
2059
2060
2061
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2053

def amend(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#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.



2064
2065
2066
2067
2068
2069
2070
2071
2072
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2064

def cancel(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#create(params = {}, opts = {}) ⇒ Object

Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.



2075
2076
2077
2078
2079
2080
2081
2082
2083
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2075

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/subscription_schedules",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(params = {}, opts = {}) ⇒ Object

Retrieves the list of your subscription schedules.



2086
2087
2088
2089
2090
2091
2092
2093
2094
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2086

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/subscription_schedules",
    params: params,
    opts: opts,
    base_address: :api
  )
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.



2097
2098
2099
2100
2101
2102
2103
2104
2105
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2097

def release(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(schedule, params = {}, opts = {}) ⇒ Object

Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.



2108
2109
2110
2111
2112
2113
2114
2115
2116
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2108

def retrieve(schedule, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(schedule, params = {}, opts = {}) ⇒ Object

Updates an existing subscription schedule.



2119
2120
2121
2122
2123
2124
2125
2126
2127
# File 'lib/stripe/services/subscription_schedule_service.rb', line 2119

def update(schedule, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end