Class: SilencerShop::Inventory

Inherits:
Base
  • Object
show all
Defined in:
lib/silencer_shop/inventory.rb

Class Method Summary collapse

Instance Method Summary collapse

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(options = {})
  requires!(options, :username, :password)

  @client = SilencerShop::Client.new(username: options[:username], password: options[:password])
end

Class Method Details

.all(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/silencer_shop/inventory.rb', line 10

def self.all(options = {})
  requires!(options, :username, :password)

  new(options).all
end

.quantityObject



15
16
17
18
19
# File 'lib/silencer_shop/inventory.rb', line 15

def self.all(options = {})
  requires!(options, :username, :password)

  new(options).all
end

Instance Method Details

#allObject



17
18
19
# File 'lib/silencer_shop/inventory.rb', line 17

def all
  @client.product_feed.availability.body.map { |item| map_hash(item) }
end