Class: NewStoreApi::StockController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::StockController
- Defined in:
- lib/new_store_api/controllers/stock_controller.rb
Overview
StockController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_product_availability_list(body: nil) ⇒ StockProductAvailabilityResponse
đ§ BETA: This endpoint is in beta and may change.
- #create_unallocated_items_list(body: nil) ⇒ StockUnallocatedItemsResponse
đ§ BETA: This endpoint is in beta and may change.- #list_atp_insights(product_id, fulfillment_node_id) ⇒ AtpInsightsResponse
âšī¸ Rate Limit: This endpoint is rate limited to 90 requests per second.- #list_unallocated_items_by_product_id(product_id: nil) ⇒ StockUnallocatedItemsResponse
Retrieves the count for unallocated items for the specified product ID.
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_product_availability_list(body: nil) ⇒ StockProductAvailabilityResponse
đ§ BETA: This endpoint is in beta and may change.Retrieves the atp for the specified product IDs. **Note**: This API only supports requesting for 2000 items. If more items need to be requested fetch the next page. The boolean ``has_more`` and the number ``total_count`` indicates if there are more pages to be fetched. of ATP keys
See API Lifecycle Documentation for details.54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
# File 'lib/new_store_api/controllers/stock_controller.rb', line 54 def create_product_availability_list(body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/v0/stock/products/availability', 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(StockProductAvailabilityResponse.method(:from_hash))) .execute end
#create_unallocated_items_list(body: nil) ⇒ StockUnallocatedItemsResponse
đ§ BETA: This endpoint is in beta and may change.Retrieves the count for unallocated items for a specified set of ``ATP keys``, where ATP keys are defined as a combination of the product ID and fulfillment location. The number of unallocated items returned in the response payload is the number of items that are sellable on hand, after removing the number of safety stock items and allocations. **Note**: This API only supports requesting for 2000 items. If more items need to be requested, use multiple requests. ATP keys
See API Lifecycle Documentation for details.123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
# File 'lib/new_store_api/controllers/stock_controller.rb', line 123 def create_unallocated_items_list(body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/v0/stock/unallocated_items', 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(StockUnallocatedItemsResponse.method(:from_hash))) .execute end
#list_atp_insights(product_id, fulfillment_node_id) ⇒ AtpInsightsResponse
âšī¸ Rate Limit: This endpoint is rate limited to 90 requests per second.Retrieves the allocations and reservations by ATP keys in your business. item. node ID of the store/warehouse.21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
# File 'lib/new_store_api/controllers/stock_controller.rb', line 21 def list_atp_insights(product_id, fulfillment_node_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v0/stock/insights', Server::API) .query_param(new_parameter(product_id, key: 'product_id')) .query_param(new_parameter(fulfillment_node_id, key: 'fulfillment_node_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(AtpInsightsResponse.method(:from_hash))) .execute end
#list_unallocated_items_by_product_id(product_id: nil) ⇒ StockUnallocatedItemsResponse
Retrieves the count for unallocated items for the specified product ID. In this request, the ATP keys are defined as a combination of the same product ID and different fulfillment locations. The number of unallocated items returned in the response payload is the number of items that are sellable on hand, after removing the number of safety stock items and allocations. Note: This API only supports requesting for 2000 items. If more items need to be requested, use multiple requests. item.
85 86 87 88 89 90 91 92 93 94 95 96 97
# File 'lib/new_store_api/controllers/stock_controller.rb', line 85 def list_unallocated_items_by_product_id(product_id: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v0/stock/unallocated_items', Server::API) .query_param(new_parameter(product_id, key: 'product_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(StockUnallocatedItemsResponse.method(:from_hash))) .execute end
- #create_unallocated_items_list(body: nil) ⇒ StockUnallocatedItemsResponse