Class: Lipseys::Inventory

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

Overview

Each method will return an array of inventory items with the following fields:

{
  item_number: content_for(item, 'ItemNo'),
  upc: content_for(item, 'UPC'),
  manufacturer_model_number: content_for(item, 'MFGModelNo'),
  quantity_on_hand: content_for(item, 'QtyOnHand'),
  allocation: (content_for(item, 'Allocation') == 'Y'),
  price: content_for(item, 'Price'),
  on_sale: (content_for(item, 'OnSale') == 'Y'),
  retail_map: content_for(item, 'RetailMAP')
}

Constant Summary collapse

API_URL =
'https://www.lipseys.com/API/pricequantitycatalog.ashx'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Inventory

Returns a new instance of Inventory.



19
20
21
22
23
# File 'lib/lipseys/inventory.rb', line 19

def initialize(options = {})
  requires!(options, :email, :password)
  @email = options[:email]
  @password = options[:password]
end

Class Method Details

.accessories(options = {}) ⇒ Object



58
59
60
# File 'lib/lipseys/inventory.rb', line 58

def self.accessories(options = {})
  new(options).accessories
end

.all(options = {}) ⇒ Object



26
27
28
# File 'lib/lipseys/inventory.rb', line 26

def self.all(options = {})
  new(options).all
end

.firearms(options = {}) ⇒ Object



34
35
36
# File 'lib/lipseys/inventory.rb', line 34

def self.firearms(options = {})
  new(options).firearms
end

.nfa(options = {}) ⇒ Object



42
43
44
# File 'lib/lipseys/inventory.rb', line 42

def self.nfa(options = {})
  new(options).nfa
end

.optics(options = {}) ⇒ Object



50
51
52
# File 'lib/lipseys/inventory.rb', line 50

def self.optics(options = {})
  new(options).optics
end

Instance Method Details

#accessoriesObject



62
63
64
# File 'lib/lipseys/inventory.rb', line 62

def accessories
  get_items('ACCESSORY')
end

#allObject



30
31
32
# File 'lib/lipseys/inventory.rb', line 30

def all
  get_items
end

#firearmsObject



38
39
40
# File 'lib/lipseys/inventory.rb', line 38

def firearms
  get_items('FIREARM')
end

#nfaObject



46
47
48
# File 'lib/lipseys/inventory.rb', line 46

def nfa
  get_items('NFA')
end

#opticsObject



54
55
56
# File 'lib/lipseys/inventory.rb', line 54

def optics
  get_items('OPTIC')
end