Class: StickyIoRestfulApiV2025731::VolumeDiscountsController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::VolumeDiscountsController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb
Overview
VolumeDiscountsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_volume_discount(body, domain, v2_ext) ⇒ ApiResponse
Create a new volume discount.
-
#copy_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Copy an existing volume discount.
-
#delete_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Delete an existing volume discount.
-
#get_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Fetch a single volume discount object.
-
#get_volume_discounts(domain, v2_ext) ⇒ ApiResponse
Fetch a list of volume discount objects.
-
#relate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Attache campaign in volume discount.
-
#unrelate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Attache campaign in volume discount.
-
#update_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Update an existing volume discount.
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
#add_volume_discount(body, domain, v2_ext) ⇒ ApiResponse
Create a new volume discount. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | name | Required | - | String | The volume discount name | | description | Optional | - | String | The volume discount description | | quantities | Required | - | Array | Array of quantity objects associated with this volume discount. | | quantities.*.tier_id | Required | - | Integer | The quantity rule _TIER ID_ associated with the volume discount profile. | | _quantities.*_.lower_bound, | Required | - | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Required | - | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | _quantities.*_.discount_type_id | Required | - | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Required | - | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | products | Required | - | Array | Array of product id’s associated with the volume discount. | | is_exclude_non_recurring | Required | - | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Required | - | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | _**Response Data**_ : Response parameters contained within the data field object: | Field | Data Type | Description | | — | — | — | | id | Integer | The volume discount ID. | | name | String | The volume discount name | | description | String | The volume discount description | | is_active | Integer Flag | The volume discount active status. | | created_at | String | The volume discount creation timestamp. | | updated_at | String | The volume discount updation timestamp. | | created_by | Integer | The admin user ID that created the volume discount. | | updated_by | Integer | The admin user ID that last updated the volume discount. | | is_exclude_non_recurring | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | | quantities | Array | Array of quantity rule object associated with the volume discount. | | quantities.*.id | Integer | The quantity rule ID associated with the volume discount profile. | | quantities.*.volume_discount_id | Integer | The volume discount ID associated with the quantity rule. | | quantities.*.lower_bound | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.discount_type_id | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | quantities.*.created_at | String | The quantity rules profile creation timestamp. | | quantities.*.updated_at | String | The quantity rules profile updation timestamp. | | products | Array | Array of product id’s associated with the volume discount. | | campaigns | Array | Array of campaign object associated with the volume discount profile. | | campaigns.*.id | Integer | The campaign ID | | campaigns.*.name | String | The campaign name | description here
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 232 def add_volume_discount(body, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}volume-discounts', 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(AddVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#copy_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Copy an existing volume discount. _**Response Data**_ : Response parameters contained within the data field object: | Field | Data Type | Description | | — | — | — | | id | Integer | The volume discount ID. | | name | String | The volume discount name | | description | String | The volume discount description | | is_active | Integer Flag | The volume discount active status. | | created_at | String | The volume discount creation timestamp. | | updated_at | String | The volume discount updation timestamp. | | created_by | Integer | The admin user ID that created the volume discount. | | updated_by | Integer | The admin user ID that last updated the volume discount. | | is_exclude_non_recurring | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | | quantities | Array | Array of quantity rule object associated with the volume discount. | | quantities.*.id | Integer | The quantity rule ID associated with the volume discount profile. | | quantities.*.volume_discount_id | Integer | The volume discount ID associated with the quantity rule. | | quantities.*.lower_bound | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.discount_type_id | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | quantities.*.created_at | String | The quantity rules profile creation timestamp. | | quantities.*.updated_at | String | The quantity rules profile updation timestamp. | | products | Array | Array of product id’s associated with the volume discount. | | campaigns | Array | Array of campaign object associated with the volume discount profile. | | campaigns.*.id | Integer | The campaign ID | | campaigns.*.name | String | The campaign name | description here
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 307 def copy_volume_discount(domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}volume-discounts/{volume_discount_id}/copy', 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(volume_discount_id, key: 'volume_discount_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(CopyVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Delete an existing volume discount. description here
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 506 def delete_volume_discount(domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}volume-discounts/{volume_discount_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(volume_discount_id, key: 'volume_discount_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(DeleteVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#get_volume_discount(domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Fetch a single volume discount object. **Response Data **Response parameters contained within the data field object: | Field | Data Type | Description | | — | — | — | | id | Integer | The volume discount ID. | | name | String | The volume discount name | | description | String | The volume discount description | | is_active | Integer Flag | The volume discount active status. | | created_at | String | The volume discount creation timestamp. | | updated_at | String | The volume discount updation timestamp. | | created_by | Integer | The admin user ID that created the volume discount. | | updated_by | Integer | The admin user ID that last updated the volume discount. | | is_exclude_non_recurring | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | | quantities | Array | Array of quantity rule object associated with the volume discount. | | quantities.*.id | Integer | The quantity rule ID associated with the volume discount profile. | | quantities.*.volume_discount_id | Integer | The volume discount ID associated with the quantity rule. | | quantities.*.lower_bound | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.discount_type_id | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | quantities.*.created_at | String | The quantity rules profile creation timestamp. | | quantities.*.updated_at | String | The quantity rules profile updation timestamp. | | products | Array | Array of product id’s associated with the volume discount. | | campaigns | Array | Array of campaign object associated with the volume discount profile. | | campaigns.*.id | Integer | The campaign ID | | campaigns.*.name | String | The campaign name | description here
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 128 def get_volume_discount(domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}volume-discounts/{volume_discount_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(volume_discount_id, key: 'volume_discount_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(GetVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#get_volume_discounts(domain, v2_ext) ⇒ ApiResponse
Fetch a list of volume discount objects. **Response Data** Response parameters expected in each volume discount object contained within the ‘data` field array: | Field | Data Type | Description | | — | — | — | | id | Integer | The volume discount ID. | | name | String | The volume discount name | | description | String | The volume discount description | | is_active | Integer Flag | The volume discount active status. | | created_at | String | The volume discount creation timestamp. | | updated_at | String | The volume discount updation timestamp. | | created_by | Integer | The admin user ID that created the volume discount. | | updated_by | Integer | The admin user ID that last updated the volume discount. | | is_exclude_non_recurring | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | | quantities | Array | Array of quantity rule object associated with the volume discount. | | quantities.*.id | Integer | The quantity rule ID associated with the volume discount profile. | | quantities.*.volume_discount_id | Integer | The volume discount ID associated with the quantity rule. | | quantities.*.lower_bound | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.discount_type_id | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | quantities.*.created_at | String | The quantity rules profile creation timestamp. | | quantities.*.updated_at | String | The quantity rules profile updation timestamp. | | products | Array | Array of product id’s associated with the volume discount. | | campaigns | Array | Array of campaign object associated with the volume discount profile. | | campaigns.*.id | Integer | The campaign ID | | campaigns.*.name | String | The campaign name |
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 57 def get_volume_discounts(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}volume-discounts', 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(GetVolumeDiscounts.method(:from_hash)) .is_api_response(true)) .execute end |
#relate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Attache campaign in volume discount. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | id | Required | - | Integer | Volume Discount ID | | is_replace | Optional | false | Bool | Replace Campaign Relationships Flag | | campaigns | Required | - | Array | Array of campaigns objects associated with this volume discount. | | campaigns.*.id | Required | - | Integer | The Campaign ID associated with the volume discount profile. | | is_all_campaigns | Optional | false | Bool | All Campaigns Flag. | TODO: type description here description here
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 353 def relate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}volume-discounts/{volume_discount_id}/campaigns', 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(volume_discount_id, key: 'volume_discount_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(AddRelateCampaignInVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#unrelate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Attache campaign in volume discount. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | id | Required | - | Integer | Volume Discount ID | | is_replace | Optional | false | Bool | Replace Campaign Relationships Flag | | campaigns | Required | - | Array | Array of campaigns objects associated with this volume discount. | | campaigns.*.id | Required | - | Integer | The Campaign ID associated with the volume discount profile. | | is_all_campaigns | Optional | false | Bool | All Campaigns Flag. | parameter: TODO: type description here description here
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 403 def unrelate_the_campaign_in_volume_discount(body, domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}volume-discounts/{volume_discount_id}/campaigns', 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(volume_discount_id, key: 'volume_discount_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(UnrelateTheCampaignInVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |
#update_volume_discount(body, domain, v2_ext, volume_discount_id) ⇒ ApiResponse
Update an existing volume discount. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | name | Required | - | String | The volume discount name | | description | Optional | - | String | The volume discount description | | quantities | Required | - | Array | Array of quantity objects associated with this volume discount. | | quantities.*.tier_id | Required | - | Integer | The quantity rule _TIER ID_ associated with the volume discount profile. | | _quantities.*_.lower_bound, | Required | - | Integer | The minimum quantity value of the quantity rule that is required to apply the volume discount. | | quantities.*.upper_bound | Required | - | Integer | The maximum quantity value of the quantity rule that is required to apply the volume discount. | | _quantities.*_.discount_type_id | Required | - | Integer | Flag that determines whether percent or dollar.
1 = percent
2 = dollar | | quantities.*.amount | Required | - | Numeric | This is the discount value which can be either PERCENT or DOLLAR depending on the discount type. | | products | Required | - | Array | Array of product id’s associated with the volume discount. | | is_exclude_non_recurring | Required | - | Integer Flag | Flag that determines whether or not the volume discount is active for non recurring products. | | apply_to_type_id | Required | - | Integer Flag | Flag that determines whether initial or recurring or it will apply for both.
1 = Initial
2 = Recurring
3 = Both | description here description here
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/volume_discounts_controller.rb', line 470 def update_volume_discount(body, domain, v2_ext, volume_discount_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}volume-discounts/{volume_discount_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(volume_discount_id, key: 'volume_discount_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(UpdateVolumeDiscount.method(:from_hash)) .is_api_response(true)) .execute end |