Class: NewStoreApi::TenantTaxConfigurationController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/tenant_tax_configuration_controller.rb

Overview

TenantTaxConfigurationController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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_tenant_config(body) ⇒ TenantConfigDto

Create tax calculation configuration for your business. description here

Parameters:

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/new_store_api/controllers/tenant_tax_configuration_controller.rb', line 53

def create_tenant_config(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/taxes/config',
                                 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(TenantConfigDto.method(:from_hash)))
    .execute
end

#show_tenant_config(version: nil) ⇒ TenantConfigDto

Get tax calculation configuration of your business. version number to fetch. If left empty, the latest version of the configuration will be returned.

Parameters:

  • version (Integer) (defaults to: nil)

    Optional parameter: Specific configuration

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/new_store_api/controllers/tenant_tax_configuration_controller.rb', line 14

def show_tenant_config(version: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/taxes/config',
                                 Server::API)
               .query_param(new_parameter(version, key: 'version'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TenantConfigDto.method(:from_hash)))
    .execute
end

#update_tenant_config(body) ⇒ TenantConfigDto

Partially update the tax configuration of your business by merging the given fields with the existing fields. description here

Parameters:

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/new_store_api/controllers/tenant_tax_configuration_controller.rb', line 33

def update_tenant_config(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/taxes/config',
                                 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(TenantConfigDto.method(:from_hash)))
    .execute
end