Class: SpreeClient::API::V1::StockLocations
- Defined in:
- lib/spree_client/api/v1/stock_locations.rb
Overview
Stock Locations
Constant Summary collapse
- ENDPOINT =
'/api/v1/stock_locations'
- RESOURCE =
SpreeClient::Models::StockLocation
- NAME =
'stock_location'
Instance Attribute Summary
Attributes inherited from Resources
#api, #default_args, #response
Instance Method Summary collapse
- #stock_items(**args) ⇒ SpreeClient::API::V1::StockItems
- #stock_movements(**args) ⇒ SpreeClient::API::V1::StockMovements
Methods inherited from Resources
#create, #delete, #index, #initialize, #new, #show, #update
Constructor Details
This class inherits a constructor from SpreeClient::API::V1::Resources
Instance Method Details
#stock_items(**args) ⇒ SpreeClient::API::V1::StockItems
22 23 24 25 26 27 28 29 |
# File 'lib/spree_client/api/v1/stock_locations.rb', line 22 def stock_items(**args) stock_location_id = default_args.dig(:id) || args.dig(:stock_location_id) raise ArgumentError, 'Needs a stock location ID' unless stock_location_id @stock_items ||= {} @stock_items[stock_location_id.to_s.to_sym] ||= StockItems.new **{ api: api, stock_location_id: stock_location_id }.merge(args) end |
#stock_movements(**args) ⇒ SpreeClient::API::V1::StockMovements
12 13 14 15 16 17 18 19 |
# File 'lib/spree_client/api/v1/stock_locations.rb', line 12 def stock_movements(**args) stock_location_id = default_args.dig(:id) || args.dig(:stock_location_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 }.merge(args) end |