Class: SpreeClient::API::V1::StockItems
- Defined in:
- lib/spree_client/api/v1/stock_items.rb
Overview
Stock Movements
Constant Summary collapse
- ENDPOINT =
'/api/v1/stock_locations/:stock_location_id/stock_items'
- RESOURCE =
SpreeClient::Models::StockItem
- NAME =
'stock_item'
Instance Attribute Summary
Attributes inherited from Resources
#api, #default_args, #response
Instance Method Summary collapse
- #destroy(_) ⇒ Object
- #stock_movements(**args) ⇒ SpreeClient::API::V1::StockMovements
- #update(_) ⇒ Object
Methods inherited from Resources
#create, #delete, #index, #initialize, #new, #show
Constructor Details
This class inherits a constructor from SpreeClient::API::V1::Resources
Instance Method Details
#destroy(_) ⇒ Object
12 |
# File 'lib/spree_client/api/v1/stock_items.rb', line 12 def destroy(_); end |
#stock_movements(**args) ⇒ SpreeClient::API::V1::StockMovements
15 16 17 18 19 20 21 22 23 |
# File 'lib/spree_client/api/v1/stock_items.rb', line 15 def stock_movements(**args) stock_location_id = default_args.dig(:stock_location_id) || args.dig(:stock_location_id) stock_item_id = default_args.dig(:id) || args.dig(:stock_item_id) raise ArgumentError, 'Needs a stock location ID' unless stock_location_id @stock_movements ||= {} @stock_movements[stock_location_id.to_s.to_sym] ||= StockMovements.new **{ api: api, stock_location_id: stock_location_id, stock_item_id: stock_item_id }.merge(args) end |
#update(_) ⇒ Object
11 |
# File 'lib/spree_client/api/v1/stock_items.rb', line 11 def update(_); end |