Class: SecondAmendmentWholesale::Inventory
- Inherits:
-
Base
- Object
- Base
- SecondAmendmentWholesale::Inventory
show all
- Includes:
- API
- Defined in:
- lib/second_amendment_wholesale/inventory.rb
Constant Summary
Constants included
from API
API::ROOT_API_URL
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from API
#delete_request, #get_request, #post_request, #put_request
Constructor Details
#initialize(options = {}) ⇒ Inventory
Returns a new instance of Inventory.
6
7
8
9
10
11
12
13
14
|
# File 'lib/second_amendment_wholesale/inventory.rb', line 6
def initialize(options = {})
requires!(options, :token)
@options = options
= [
*(@options[:token]),
*('application/json'),
].to_h
end
|
Class Method Details
.all(options = {}) ⇒ Object
16
17
18
19
20
|
# File 'lib/second_amendment_wholesale/inventory.rb', line 16
def self.all(options = {})
requires!(options, :token)
new(options).all
end
|
.quantity ⇒ Object
21
22
23
24
25
|
# File 'lib/second_amendment_wholesale/inventory.rb', line 21
def self.all(options = {})
requires!(options, :token)
new(options).all
end
|
Instance Method Details
#all ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/second_amendment_wholesale/inventory.rb', line 23
def all
items = []
response = get_request("feed/stockV2", )
response.body.each do |item|
items << map_hash(item)
end
items
end
|