Class: StickyIoRestfulApiV2025731::SubscriptionsController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::SubscriptionsController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb
Overview
SubscriptionsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#bill_subscription_now(domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here here.
-
#force_next_gateway_by_order_i_ds(body, domain, v2_ext) ⇒ ApiResponse
Force the next gateway for subscriptions tied to specified order IDs.
-
#get_subsciption_history(domain, v2_ext, subscription_id) ⇒ ApiResponse
Returns all orders in the history (order chain) of the given Subscription ID.
-
#get_subsciptions_with_filter(value, domain, v2_ext, filter) ⇒ ApiResponse
This function allows to list subscriptions based on the ‘filter` passed in the URL.
-
#get_subscription(domain, v2_ext, subscription_id) ⇒ ApiResponse
Gets the subscription for the given ID.
-
#update_offer(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here description here here.
-
#update_recurring_date(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here description here here.
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 StickyIoRestfulApiV2025731::BaseController
Instance Method Details
#bill_subscription_now(domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here here
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 15 def bill_subscription_now(domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}subscriptions/{subscription_id}/bill_now', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(BillSubscriptionNowDecline.method(:from_hash)) .is_api_response(true) .local_error('404', 'Not Found', BillSubscriptionNowInvalidIdException)) .execute end |
#force_next_gateway_by_order_i_ds(body, domain, v2_ext) ⇒ ApiResponse
Force the next gateway for subscriptions tied to specified order IDs. ‘keys` is an array of Order IDs. type description here
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 136 def force_next_gateway_by_order_i_ds(body, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}subscriptions', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ForceNextGatewayByOrderIDs.method(:from_hash)) .is_api_response(true)) .execute end |
#get_subsciption_history(domain, v2_ext, subscription_id) ⇒ ApiResponse
Returns all orders in the history (order chain) of the given Subscription ID. When a single transaction is made with more than one subscription product the first product is created as an ‘Order’ model and all subsequent products in that order are created as ‘Upsell’ models. Upsells are included in this response along with their main order data in the ‘main’ key. here
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 382 def get_subsciption_history(domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}subscriptions/{subscription_id}/history', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#get_subsciptions_with_filter(value, domain, v2_ext, filter) ⇒ ApiResponse
This function allows to list subscriptions based on the ‘filter` passed in the URL. `filter` possible values: `order`, `email`. If `filter` is `email` then the parameter `value` in the request should be an email address, if it is `order` then `value` should be an order id. filter
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 342 def get_subsciptions_with_filter(value, domain, v2_ext, filter) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}subscriptions/filter/{filter}', Server::SERVER_1) .query_param(new_parameter(value, key: 'value') .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(filter, key: 'filter') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetSubsciption.method(:from_hash)) .is_api_response(true)) .execute end |
#get_subscription(domain, v2_ext, subscription_id) ⇒ ApiResponse
Gets the subscription for the given ID. **Response Data** Response parameters expected in object contained within the ‘data` field object: | Field | Data Type | Description | | — | — | — | | id | String | The Subscription ID. | | contact_id | Integer | The Subscription contact ID. | | created_at | String | The Subscription date timestamp. | | is_recurring | Boolean | True if the Subscription is recurring. | | recur_at | String | The Subscription recurring date. | | forecasted_revenue | Numeric | The Subscription forecasted revenue. | | credit | Numeric | The Subscription credit. | | ith variants. | | | | product | Object | The Subscription product. | | product.id | Integer | The Subscription product ID. | | product.variant_id | Integer | The Subscription product variant ID. | | product.name | Integer | The Subscription product name. | | product.quantity | Integer | The Subscription product quantity. | | product.children | Array | The Subscription product children. | | product.children.*.id | Integer | The Subscription product children ID. | | product.children.*.variant_id | Integer | The Subscription product children variant ID. | | product.children.*.name | Integer | The Subscription product children name. | | product.children.*.quantity | Integer | The Subscription product children quantity. | | next_product | Object | The Subscription product. | | next_product.id | Integer | The Subscription next product ID. | | next_product.variant_id | Integer | The Subscription next product variant ID. | | next_product.name | Integer | The Subscription next product name. | | next_product.quantity | Integer | The Subscription next product quantity. | | next_product.children | Array | The Subscription next product children. | | next_product.children.*.id | Integer | The Subscription next product children ID. | | next_product.children.*.variant_id | Integer | The Subscription next product children variant ID. | | next_product.children.*.name | Integer | The Subscription next product children name. | | next_product.children.*.quantity | Integer | The Subscription next product children quantity. | | shipping | Object | Object containing Subscription shipping details. | | shipping.first_name | String | The Subscription subject shipping first name. | | shipping.last_name | String | The Subscription subject shipping last name. | | shipping.address | String | The Subscription subject shipping address. | | shipping.address2 | String | The Subscription subject shipping alternative address. | | shipping.city | String | The Subscription subject shipping city. | | shipping.state | String | The Subscription subject shipping state. | | shipping.zip | String | The Subscription subject shipping city zip code. | | shipping.country | String | The Subscription subject country. | | shipping.country2 | String | The Subscription subject shipping city ISO code. | | discounts | Object | Object containing Subscription discount details. | | discounts.flat_amount | Numeric | The flat amount of the discount. | | discounts.percent | Numeric | The percent amount of the discount. | | discounts.prepaid | Numeric | The prepaid amount of the discount. | | status | String | There are 4 types of subscription statuses:
- active
- paused
- retrying
- cancelled | | billing_model.id | Integer | The billing model ID. | | billing_model.name | String | The billing model name. | | billing_model.expire_cycles | Integer | The number of cycles until billing model expires. | | billing_model.created_at | Object | Contains details of when the billing model was created. | | billing_model.created_at.*.date | String | A timestamp when the billing model was created. | | billing_model.created_at.*.timezone_type | Integer | The timezone type number where the billing model was created. | | billing_model.created_at.*.timezone | String | The name of the timezone where the billing model was created. | | billing_model.updated_at | Object | Contains details of when the billing model was created | | billing_model.updated_at .*.date | String | A timestamp when the billing model was updated. | | billing_model.updated_at.*.timezone_type | Integer | The timezone type number where the billing model was updated. | | billing_model.updated_at.*.timezone | String | The name of the timezone where the billing model was updated. | | billing_model.is_archived | Integer Flag | The billing model archived status. | | billing_model.is_preserve_quantity | Integer Flag | The billing model status to preserve initial order quantity. | | billing_model.is_default | Integer Flag | The billing model default status. | | billing_model.week | Integer | A number between 1 and 5 that represents the week in a month of next billing period. | | billing_model.day | Integer | A number between 1 and 7 that represents the day of the week of next billing period. | | billing_model.days | Integer | The number of days between the next billing period. | | billing_model.date | Integer | The billing date of the month.A number between 1 and 31. | | billing_model.dates | Array | A list of bill frequency dates | | billing_model.description | String | A description of the billing model. | | billing_model.type | Object | Contains details about billing model type | | billing_model.type.*.id | Integer | The billing model type ID. | | billing_model.type.*.name | String | The billing model type name. | | billing_model.frequency | Integer | The number of billing periods within the frequency type. | | billing_model.frequency_type_id | Integer | A number that represents the frequency type. Either monthly or yearly. | | billing_model.cut_off_day | Integer | The frequency type id. Alias to buffer_days | | billing_model.creator | Object | Contains details of the billing model creator. | | billing_model.creator.*.department_id | Integer | The department ID assigned to the billing model creator. | | billing_model.creator.*.is_active | Integer Flag | The billing model creator active status. | | billing_model.creator.*.name | String | The billing model creator name. | | billing_model.creator.*.email | String | The billing model creator email address. | | billing_model.creator.*.call_center_provider_id | Integer | The call center provided ID who created the billing model. | | billing_model.updator | Object | Contains details of the billing model updator | | billing_model.updator.*.department_id | Integer | The department ID assigned to the billing model updator. | | billing_model.updator.*.is_active | Integer Flag | The billing model updator active status. | | billing_model.updator.*.name | String | The billing model updator name. | | billing_model.updator.*.email | String | The billing model updator email address. | | billing_model.updator.*.call_center_provider_id | Integer | The call center provided ID who updated the billing model. | | stop_after_next_rebill | Boolean | True if the order that have been set to stop recurring after next successful rebill. | here
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 306 def get_subscription(domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}subscriptions/{subscription_id}', Server::SERVER_1) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetSubscription.method(:from_hash)) .is_api_response(true)) .execute end |
#update_offer(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here description here here
96 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 123 124 125 126 127 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 96 def update_offer(body, domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}subscriptions/{subscription_id}/offer', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateOfferStandard.method(:from_hash)) .is_api_response(true) .local_error('422', 'Unprocessable Entity', UpdateOfferProductNotOnOfferException)) .execute end |
#update_recurring_date(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
TODO: type endpoint description here description here here
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/subscriptions_controller.rb', line 52 def update_recurring_date(body, domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}subscriptions/{subscription_id}/recur_at', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateRecurringDateSuccess.method(:from_hash)) .is_api_response(true) .local_error('404', 'Not Found', UpdateRecurringDateInvalidSubscriptionIdException) .local_error('422', 'Unprocessable Entity', UpdateRecurringDateInvalidFormatException)) .execute end |