Class: SilencerShop::Inventory
- Defined in:
- lib/silencer_shop/inventory.rb
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(options = {}) ⇒ Inventory
constructor
A new instance of Inventory.
Constructor Details
#initialize(options = {}) ⇒ Inventory
Returns a new instance of Inventory.
4 5 6 7 8 |
# File 'lib/silencer_shop/inventory.rb', line 4 def initialize( = {}) requires!(, :username, :password) @client = SilencerShop::Client.new(username: [:username], password: [:password]) end |
Class Method Details
.all(options = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/silencer_shop/inventory.rb', line 10 def self.all( = {}) requires!(, :username, :password) new().all end |
.quantity ⇒ Object
15 16 17 18 19 |
# File 'lib/silencer_shop/inventory.rb', line 15 def self.all( = {}) requires!(, :username, :password) new().all end |
Instance Method Details
#all ⇒ Object
17 18 19 |
# File 'lib/silencer_shop/inventory.rb', line 17 def all @client.product_feed.availability.body.map { |item| map_hash(item) } end |