Class: NewStoreApi::StoreTaxConfigurationController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::StoreTaxConfigurationController
- Defined in:
- lib/new_store_api/controllers/store_tax_configuration_controller.rb
Overview
StoreTaxConfigurationController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_store_config(body) ⇒ StoreConfigDto
Create a tax calculation configuration for the specified store identifier.
-
#destroy_store_config(id) ⇒ void
Delete tax configuration for the given store identifier.
-
#list_store_configs(limit, tax_calculation_strategy: nil, next_page_key: nil) ⇒ StoreConfigListDto
List store tax calculation configurations with the given query.
-
#show_store_config(id, version: nil, merged_tenant_fallback: true) ⇒ StoreConfigDto | ConfigDto
Get tax configuration for the given store identifier.
-
#update_store_config(id, body) ⇒ StoreConfigDto
Partially update the tax configuration of a store by merging the given fields with the existing fields.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from NewStoreApi::BaseController
Instance Method Details
#create_store_config(body) ⇒ StoreConfigDto
Create a tax calculation configuration for the specified store identifier. description here
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/new_store_api/controllers/store_tax_configuration_controller.rb', line 39 def create_store_config(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/taxes/config/stores', Server::API) .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('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreConfigDto.method(:from_hash))) .execute end |
#destroy_store_config(id) ⇒ void
This method returns an undefined value.
Delete tax configuration for the given store identifier.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/new_store_api/controllers/store_tax_configuration_controller.rb', line 58 def destroy_store_config(id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/taxes/config/stores/{id}', Server::API) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end |
#list_store_configs(limit, tax_calculation_strategy: nil, next_page_key: nil) ⇒ StoreConfigListDto
List store tax calculation configurations with the given query. value. parameter: Tax calculation strategy to filter by. the next page of results.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/new_store_api/controllers/store_tax_configuration_controller.rb', line 17 def list_store_configs(limit, tax_calculation_strategy: nil, next_page_key: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/taxes/config/stores', Server::API) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(tax_calculation_strategy, key: 'tax_calculation_strategy')) .query_param(new_parameter(next_page_key, key: 'next_page_key')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreConfigListDto.method(:from_hash))) .execute end |
#show_store_config(id, version: nil, merged_tenant_fallback: true) ⇒ StoreConfigDto | ConfigDto
Get tax configuration for the given store identifier. version number to fetch. If left empty, the latest version of the configuration will be returned. Flag that indicates if the store configuration should be merged with the tenant configuration to provide tenant level fallbacks to the store. This flag defaults to true if it is not sent.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/new_store_api/controllers/store_tax_configuration_controller.rb', line 81 def show_store_config(id, version: nil, merged_tenant_fallback: true) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/taxes/config/stores/{id}', Server::API) .template_param(new_parameter(id, key: 'id') .should_encode(true)) .query_param(new_parameter(version, key: 'version')) .query_param(new_parameter(merged_tenant_fallback, key: 'merged_tenant_fallback')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(proc do |response, should_symbolize| APIHelper.deserialize_union_type( UnionTypeLookUp.get(:ShowStoreConfigResponse), response, should_symbolize, true ) end)) .execute end |
#update_store_config(id, body) ⇒ StoreConfigDto
Partially update the tax configuration of a store by merging the given fields with the existing fields. description here
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/new_store_api/controllers/store_tax_configuration_controller.rb', line 110 def update_store_config(id, body) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/taxes/config/stores/{id}', Server::API) .template_param(new_parameter(id, key: 'id') .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('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreConfigDto.method(:from_hash))) .execute end |