Class: NewStoreApi::InventoryConfigurationController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::InventoryConfigurationController
- Defined in:
- lib/new_store_api/controllers/inventory_configuration_controller.rb
Overview
InventoryConfigurationController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#replace_inventory_config(body) ⇒ void
Sets the configuration.
-
#show_inventory_config(store_id: nil) ⇒ ConfigModelResponse
Returns the current inventory configuration.
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
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.
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 |