Class: Snap::Api::StockTotals
- Inherits:
-
Object
- Object
- Snap::Api::StockTotals
show all
- Extended by:
- Client
- Includes:
- HTTParty
- Defined in:
- lib/snap/api/stock_totals.rb
Overview
Interact with the stock totals endpoint.
Class Method Summary
collapse
Methods included from Client
client, delete, get, post, put, snoop_for_errors, wrap_response
Class Method Details
.find(sku:) ⇒ Object
12
13
14
|
# File 'lib/snap/api/stock_totals.rb', line 12
def self.find(sku:)
client.get("/stocktotals?$filter=SKUId eq '#{sku}'")
end
|
.find!(sku:) ⇒ Object
16
17
18
19
20
21
|
# File 'lib/snap/api/stock_totals.rb', line 16
def self.find!(sku:)
response = find(sku: sku)
raise Api::StockTotalNotFoundError, "No stock totals found for #{sku}" if response.empty?
response
end
|
.index ⇒ Object
8
9
10
|
# File 'lib/snap/api/stock_totals.rb', line 8
def self.index
client.get('/stocktotals')
end
|
.model ⇒ Object
23
24
25
|
# File 'lib/snap/api/stock_totals.rb', line 23
def self.model
Snap::StockTotalList
end
|