Class: StickyIoRestfulApiV2025731::BillingModelsController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::BillingModelsController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb
Overview
BillingModelsController
Constant Summary
Constants inherited from BaseController
StickyIoRestfulApiV2025731::BaseController::GLOBAL_ERRORS
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_billing_model(body, domain, v2_ext) ⇒ ApiResponse
Create a billing model.
-
#delete_billing_model(domain, v2_ext, billing_model_id) ⇒ ApiResponse
TODO: type endpoint description here description here.
-
#get_available_billing_models(domain, v2_ext, subscription_id) ⇒ ApiResponse
Get billing model options for a subscription.
-
#get_billing_model(domain, v2_ext, billing_model_id) ⇒ ApiResponse
TODO: type endpoint description here description here.
-
#get_billing_models(domain, v2_ext) ⇒ ApiResponse
Fetch a list of saved billing models.
-
#update_billing_model(body, domain, v2_ext, billing_model_id) ⇒ ApiResponse
Update a billing model.
-
#update_billing_model1(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
Updates the billing model for the order subscription ID.
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
#create_billing_model(body, domain, v2_ext) ⇒ ApiResponse
Create a billing model. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | ——————————— | ——– | — | ———— | ————————————– | | name | Required | - | String | The billing model name. | | type_id | Required | - | Integer | The billing model type ID. See Get Types request. | | is_preserve_quantity | Optional | 0 | Integer Flag | Allows the quantity purchased on initial order to apply to the subsequent recurring orders. | | week | Required with frequency type ID 3 | 0 | Integer | A number between 1 and 5 that represents the week in a month of next billing period. | | day | Required with frequency type ID 3 | 0 | Integer | A number between 1 and 7 that represents the day of the week of next billing period. | | days | Required with frequency type ID 1 | 0 | Integer | The number of days between the next billing period. Subscription will bill every N days. | | date | Required with frequency type ID 2 | 0 | Integer | The billing date of the month. A number between 1 and
-
Subscription will bill on the Nth day of each month.|
| dates | Required with frequency type ID 4 | 0 | Array | A list of specific billing dates. | | frequency | Required with frequency type ID 5 | 0 | Integer | The number of billing periods relative to day of purchase. | | frequency_type_id | Required with frequency type ID 5 | 0 | Integer | A number that represents the frequency type. See Get Frequency Types request. | | buffer_days | Optional with frequency type ID 4 | 0 | Integer | If you provide a value for this field, the system will look to see if the transaction date is equal or less than the buffer days, if so the next upcoming rebill date will be skipped.| description here
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 161 def create_billing_model(body, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}billing_models', 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(BillByCycle.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_billing_model(domain, v2_ext, billing_model_id) ⇒ ApiResponse
TODO: type endpoint description here description here
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 274 def delete_billing_model(domain, v2_ext, billing_model_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}billing_models/{billing_model_id}', 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(billing_model_id, key: 'billing_model_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_available_billing_models(domain, v2_ext, subscription_id) ⇒ ApiResponse
Get billing model options for a subscription. **Response Data**\ Response parameters expected in each trial workflow object contained within the ‘data` field array: | Field | Data Type | Description
|
| ————————————— | ———— | ————————————– | | id | Integer | The Billing Model Option ID. | | name | String | The Billing Model Option name. | | buffer_days | Integer | The Billing Model Option buffer days. | | created_at | Object | Object that contains data pertaining to the Billing Model Option creation date.
|
| created_at.date | String | The Billing Model Option date timestamp. . | | created_at.timezone_type | String | The Billing Model Option timezone identifier. | | created_at.timezone | String | The Billing Model Option recurring date timestamp timezone.
|
| updated_at | Object | Object that contains data pertaining to the Billing Model Option update date.
|
| updated_at.date | String | The Billing Model Option update date timestamp. . | | updated_at.timezone_type | String | The Billing Model Option timezone identifier. | | updated_at.timezone | String | The Billing Model Option recurring date timestamp timezone.
|
| is_preserve_quantity | Boolean | Determines if the quantity should be preserved or not.
|
| type | Object | Object containing Billing Model Option data. | | type.id | Integer | The Billing Model Option type ID. | | type.name | String | The Billing Model Option type name. | | creator | Object | Object that contains data pertaining to the user that created the Billing Model.
|
| creator.department_id | Integer | Department ID associated with the admin user. | | creator.timezone | String | The admin user timezone.
|
| creator.id | Integer | The user active status.
|
| creator.is_active | Boolean | The admin user active status. | | creator.name | String | The user name. | | creator.email | String | The user email. | | creator.call_center_provider_id | Integer
| The call center provider ID associated with the user.
|
| updator | Object | Object that contains data pertaining to the user that updated the Billing Model.
|
| updator.department_id | Integer | Department ID associated with the admin user. | | updator.timezone | String | The admin user timezone.
|
| updator.id | Integer | The user active status.
|
| updator.is_active | Boolean | The admin user active status. | | updator.name | String | The user name. | | updator.email | String | The user email. | | updator.call_center_provider_id | Integer
| The call center provider ID associated with the user.
|
here
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 388 def get_available_billing_models(domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}subscriptions/{subscription_id}/billing_models', 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(GetAvailableBillingModels.method(:from_hash)) .is_api_response(true) .local_error('404', 'Not Found', GetAvailableBillingModelsInvalidSubscriptionIdException) .local_error('422', 'Unprocessable Entity', GetAvailableBillingModelsNutraException)) .execute end |
#get_billing_model(domain, v2_ext, billing_model_id) ⇒ ApiResponse
TODO: type endpoint description here description here
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 242 def get_billing_model(domain, v2_ext, billing_model_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}billing_models/{billing_model_id}', 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(billing_model_id, key: 'billing_model_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(GetBillingModel.method(:from_hash)) .is_api_response(true)) .execute end |
#get_billing_models(domain, v2_ext) ⇒ ApiResponse
Fetch a list of saved billing models. **Response Data**\ Response parameters expected in each billing model object contained within the ‘data` field array: | Field | Data Type | Description
|
| ————————————— | ———— | ————————————– | | id | Integer | The billing model ID.
|
| name | String | The billing model name. | | expire_cycles | Integer | The number of cycles until billing model expires. | | created_at | Object | Contains details of when the billing model was created. | | created_at.*.date | String | A timestamp when the billing model was created. | | created_at.*.timezone_type | Integer | The timezone type number where the billing model was created. | | created_at.*.timezone | String | The name of the timezone where the billing model was created. | | updated_at | Object | Contains details of when the billing model was created | | updated_at .*.date | String | A timestamp when the billing model was updated. | |updated_at.*.timezone_type | Integer | The timezone type number where the billing model was updated. | |updated_at.*.timezone | String | The name of the timezone where the billing model was updated. | | is_archived | Integer Flag | The billing model archived status. | | is_preserve_quantity | Integer Flag | The billing model status to preserve initial order quantity. | | is_default | Integer Flag | The billing model default status. | | week | Integer | A number between 1 and 5 that represents the week in a month of next billing period. | | day | Integer | A number between 1 and 7 that represents the day of the week of next billing period. | | days | Integer | The number of days between the next billing period. | | date | Integer | The billing date of the month.A number between 1 and 31. | | dates | Array | A list of bill frequency dates | | description | String | A description of the billing model. | | type | Object | Contains details about billing model type | | type.*.id | Integer | The billing model type ID. | | type.*.name | String | The billing model type name. | | frequency | Integer | The number of billing periods within the frequency type. | | frequency_type_id | Integer | A number that represents the frequency type. Either monthly or yearly. | | cut_off_day | Integer | The frequency type id. Alias to buffer_days | | creator | Object | Contains details of the billing model creator. | | creator.*.department_id | Integer | The department ID assigned to the billing model creator. | | creator.*.is_active | Integer Flag | The billing model creator active status. | | creator.*.name | String | The billing model creator name. | | creator.*.email | String | The billing model creator email address. | | creator.*.call_center_provider_id | Integer | The call center provided ID who created the billing model. | | updator | Object | Contains details of the billing model updator | | updator.*.department_id | Integer | The department ID assigned to the billing model updator. | | updator.*.is_active | Integer Flag | The billing model updator active status. | | updator.*.name | String | The billing model updator name.| | updator.*.email | String | The billing model updator email address. | | updator.*.call_center_provider_id | Integer | The call center provided ID who updated the billing model. |
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 96 def get_billing_models(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}billing_models', 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)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetBillingModels.method(:from_hash)) .is_api_response(true)) .execute end |
#update_billing_model(body, domain, v2_ext, billing_model_id) ⇒ ApiResponse
Update a billing model. **Request Data**\ Additional request parameters available after the billing model is created: | Field | Requirement | Default | Data Type | Description | | ——————————— | ——– | — | ———— | ————————————– | | is_archived | Optional | - | Integer Flag | The billing model archived status. | | is_default | Optional | - | Integer Flag | The billing model default. | description here description here
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 206 def update_billing_model(body, domain, v2_ext, billing_model_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}billing_models/{billing_model_id}', 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(billing_model_id, key: 'billing_model_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(UpdateBillingModel.method(:from_hash)) .is_api_response(true)) .execute end |
#update_billing_model1(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
Updates the billing model for the order subscription ID. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | ——————————— | ——– | — | ———— | ————————————– | | billing_model_id | Required | - | Integer
| The new Billing Model ID.
parameter: TODO: type description here here
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/billing_models_controller.rb', line 436 def update_billing_model1(body, domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}subscriptions/{subscription_id}/billing_model', 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(UpdateBillingModelUpdateBillingModel.method(:from_hash)) .is_api_response(true) .local_error('404', 'Not Found', UpdateBillingModelInvalidSubscriptionIdException) .local_error('422', 'Unprocessable Entity', UpdateBillingModelNotOnOfferException)) .execute end |