Class: NewStoreApi::CustomerConfigurationController

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

Overview

CustomerConfigurationController

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_configurationConfigurationResponse

Returns configuration settings for the tenant, including BYO CRM settings.

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/new_store_api/controllers/customer_configuration_controller.rb', line 11

def show_configuration
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/config',
                                 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(ConfigurationResponse.method(:from_hash)))
    .execute
end

#update_configuration(body) ⇒ ConfigurationResponse

Updates configuration settings for the tenant, including BYO CRM settings. Note that the following restrictions exist:

  • BYO CRM and nom_consumer_profiles_merge can't be enabled at the same time. settings to update

Parameters:

Returns:



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

def update_configuration(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/customer/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(ConfigurationResponse.method(:from_hash)))
    .execute
end