Class: NewStoreApi::OrderInjectionConfigController

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

Overview

OrderInjectionConfigController

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_order_injection_configuration(version, body: nil) ⇒ OrderInjectionConfigurationResponse

Use this method to create a new order injection configuration or completely replace the current configuration for your business. The version value in the query parameter must either be set to 1 or it must match the latest version returned by the GET endpoint. updated config value

Parameters:

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/new_store_api/controllers/order_injection_config_controller.rb', line 62

def create_order_injection_configuration(version,
                                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v1/r/config/order_injection',
                                 Server::API)
               .query_param(new_parameter(version, key: 'version'))
               .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(OrderInjectionConfigurationResponse.method(:from_hash)))
    .execute
end

#show_order_injection_configurationOrderInjectionConfigurationResponse

Retrieves the current order injection configuration set up for your business. The response payload also contains the current version of the configuration, the timestamp when it was last updated, and who updated it.

Returns:



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

def show_order_injection_configuration
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/r/config/order_injection',
                                 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(OrderInjectionConfigurationResponse.method(:from_hash)))
    .execute
end

#update_order_injection_configuration(version, body: nil) ⇒ OrderInjectionConfigurationResponse

Updates the current order injection configuration for your business. The version value in the query parameter must match the latest version returned by the GET endpoint. updated config value

Parameters:

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/new_store_api/controllers/order_injection_config_controller.rb', line 35

def update_order_injection_configuration(version,
                                         body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/v1/r/config/order_injection',
                                 Server::API)
               .query_param(new_parameter(version, key: 'version'))
               .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(OrderInjectionConfigurationResponse.method(:from_hash)))
    .execute
end