Class: NewStoreApi::TenantConfigController

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

Overview

TenantConfigController

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

#show_tenant_config(version: nil, include_metadata: false) ⇒ TenantConfigV1Dto

Get fiscal configuration of the tenant. If left empty, the latest version of the configuration will be returned. Include metadata fields.

Parameters:

  • version (Float) (defaults to: nil)

    Optional parameter: Configuration version number. *

  • include_metadata (TrueClass | FalseClass) (defaults to: false)

    Optional parameter:

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/new_store_api/controllers/tenant_config_controller.rb', line 15

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

#show_tenant_offline_mode_configOfflineCountriesResponseV1Dto

Get list of countries supporting offline-mode for the tenant.

Returns:



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

def show_tenant_offline_mode_config
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/config/offline-mode',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(OfflineCountriesResponseV1Dto.method(:from_hash)))
    .execute
end

#update_tenant_offline_mode_config(body) ⇒ OfflineCountriesResponseV1Dto

Update list of countries supporting offline-mode for the tenant.

  • Only editable countries are allowed.
  • List of editable countries can be retireved through GET /f11n/config. type description here

Parameters:

Returns:



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

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