Class: StickyIoRestfulApiV2025731::DiscountController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::DiscountController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/discount_controller.rb
Overview
DiscountController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_update_discount(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
Updates the discount for the given order subscription ID.
-
#destroy_discount(domain, v2_ext, subscription_id) ⇒ ApiResponse
Delete the discount for the given 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
#add_update_discount(body, domain, v2_ext, subscription_id) ⇒ ApiResponse
Updates the discount for the given order subscription ID. | Field | Requirement | Default | Data Type | Description | | ——————————— | ——– | — | ———— | ————————————– | | amount | Required | - | Numeric | The new discount amount. | description here here
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/discount_controller.rb', line 23 def add_update_discount(body, domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}subscriptions/{subscription_id}/discount', 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(RemoveNextCouponPromoCode.method(:from_hash)) .is_api_response(true) .local_error('422', 'Unprocessable Entity', AddUpdateDiscountNoParametersException)) .execute end |
#destroy_discount(domain, v2_ext, subscription_id) ⇒ ApiResponse
Delete the discount for the given order subscription ID. here
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 87 88 89 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/discount_controller.rb', line 62 def destroy_discount(domain, v2_ext, subscription_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}subscriptions/{subscription_id}/discount', 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(DestroyDiscount.method(:from_hash)) .is_api_response(true) .local_error('422', 'Unprocessable Entity', DestroyDiscountNoPlacedWithBillingModelsOffersException)) .execute end |