Class: AdvancedBilling::SubscriptionRenewalsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/advanced_billing/controllers/subscription_renewals_controller.rb

Overview

SubscriptionRenewalsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from AdvancedBilling::BaseController

Instance Method Details

#cancel_scheduled_renewal_configuration(subscription_id, id) ⇒ ScheduledRenewalConfigurationResponse

Cancels a scheduled renewal configuration. the subscription.

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

Returns:

  • Response from the API call.



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 219

def cancel_scheduled_renewal_configuration(subscription_id,
                                           id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}/cancel.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#create_scheduled_renewal_configuration(subscription_id, body: nil) ⇒ ScheduledRenewalConfigurationResponse

Creates a scheduled renewal configuration for a subscription. The scheduled renewal is based on the subscription’s current product and component setup. the subscription. TODO: type description here

Parameters:

  • Required parameter: The Chargify id of

  • (defaults to: nil)

    Optional parameter:

Returns:

  • Response from the API call.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 17

def create_scheduled_renewal_configuration(subscription_id,
                                           body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/subscriptions/{subscription_id}/scheduled_renewals.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#create_scheduled_renewal_configuration_item(subscription_id, scheduled_renewals_configuration_id, body: nil) ⇒ ScheduledRenewalConfigurationItemResponse

Adds product and component line items to the scheduled renewal. the subscription. The scheduled renewal configuration id. TODO: type description here

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter:

  • (defaults to: nil)

    Optional parameter:

Returns:

  • Response from the API call.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 250

def create_scheduled_renewal_configuration_item(subscription_id,
                                                scheduled_renewals_configuration_id,
                                                body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationItemResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#delete_scheduled_renewal_configuration_item(subscription_id, scheduled_renewals_configuration_id, id) ⇒ void

This method returns an undefined value.

Removes an item from the pending renewal configuration. the subscription. The scheduled renewal configuration id. configuration item id.

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter:

  • Required parameter: The scheduled renewal



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 326

def delete_scheduled_renewal_configuration_item(subscription_id,
                                                scheduled_renewals_configuration_id,
                                                id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items/{id}.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .is_response_void(true)
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#list_scheduled_renewal_configurations(subscription_id, status: nil) ⇒ ScheduledRenewalConfigurationsResponse

Lists scheduled renewal configurations for the subscription and permits an optional status query filter. the subscription. scheduled renewal configurations.

Parameters:

  • Required parameter: The Chargify id of

  • (defaults to: nil)

    Optional parameter: (Optional) Status filter for

Returns:

  • Response from the API call.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 47

def list_scheduled_renewal_configurations(subscription_id,
                                          status: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/subscriptions/{subscription_id}/scheduled_renewals.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .query_param(new_parameter(status, key: 'status'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationsResponse.method(:from_hash)))
    .execute
end

#lock_in_scheduled_renewal_immediately(subscription_id, id) ⇒ ScheduledRenewalConfigurationResponse

Locks in the renewal immediately. the subscription.

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

Returns:

  • Response from the API call.



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 163

def lock_in_scheduled_renewal_immediately(subscription_id,
                                          id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}/immediate_lock_in.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#read_scheduled_renewal_configuration(subscription_id, id) ⇒ ScheduledRenewalConfigurationResponse

Retrieves the configuration settings for the scheduled renewal. the subscription.

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

Returns:

  • Response from the API call.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 70

def read_scheduled_renewal_configuration(subscription_id,
                                         id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)))
    .execute
end

#schedule_scheduled_renewal_lock_in(subscription_id, id, body: nil) ⇒ ScheduledRenewalConfigurationResponse

Schedules a future lock-in date for the renewal. the subscription. description here

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

  • (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • Response from the API call.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 131

def schedule_scheduled_renewal_lock_in(subscription_id,
                                       id,
                                       body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}/schedule_lock_in.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#unpublish_scheduled_renewal_configuration(subscription_id, id) ⇒ ScheduledRenewalConfigurationResponse

Returns a scheduled renewal configuration to an editable state. the subscription.

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

Returns:

  • Response from the API call.



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 191

def unpublish_scheduled_renewal_configuration(subscription_id,
                                              id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}/unpublish.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#update_scheduled_renewal_configuration(subscription_id, id, body: nil) ⇒ ScheduledRenewalConfigurationResponse

Updates an existing configuration. the subscription. TODO: type description here

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter: The renewal id.

  • (defaults to: nil)

    Optional parameter:

Returns:

  • Response from the API call.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 97

def update_scheduled_renewal_configuration(subscription_id,
                                           id,
                                           body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end

#update_scheduled_renewal_configuration_item(subscription_id, scheduled_renewals_configuration_id, id, body: nil) ⇒ ScheduledRenewalConfigurationItemResponse

Updates an existing configuration item’s pricing and quantity. the subscription. The scheduled renewal configuration id. configuration item id. description here

Parameters:

  • Required parameter: The Chargify id of

  • Required parameter:

  • Required parameter: The scheduled renewal

  • (defaults to: nil)

    Optional parameter: TODO: type

Returns:

  • Response from the API call.



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/advanced_billing/controllers/subscription_renewals_controller.rb', line 287

def update_scheduled_renewal_configuration_item(subscription_id,
                                                scheduled_renewals_configuration_id,
                                                id,
                                                body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items/{id}.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(subscription_id, key: 'subscription_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id')
                                .is_required(true)
                                .should_encode(true))
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ScheduledRenewalConfigurationItemResponse.method(:from_hash))
                .local_error('422',
                             'Unprocessable Entity (WebDAV)',
                             ErrorListResponseException))
    .execute
end