Class: NewStoreApi::InventoryConfigurationController

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

Overview

InventoryConfigurationController

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

#replace_inventory_config(body) ⇒ void

This method returns an undefined value.

Sets the configuration. Note: you can pass an * to enable store-dependent features. here

Parameters:

  • body (ConfigModel)

    Required parameter: TODO: type description



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

def replace_inventory_config(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/inventory/config',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#show_inventory_config(store_id: nil) ⇒ ConfigModelResponse

Returns the current inventory configuration. configuration at store level.

Parameters:

  • store_id (String) (defaults to: nil)

    Optional parameter: Store Identifier for store

Returns:



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

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