Class: Lipseys::Catalog

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

Overview

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

{
  item_number: content_for(item, 'ItemNo'),
  description_1: content_for(item, 'Desc1'),
  description_2: content_for(item, 'Desc2'),
  upc: content_for(item, 'UPC'),
  manufacturer_model_number: content_for(item, 'MFGModelNo'),
  msrp: content_for(item, 'MSRP'),
  model: content_for(item, 'Model'),
  caliber: content_for(item, 'Caliber'),
  manufacturer: content_for(item, 'MFG'),
  type: content_for(item, 'Type'),
  action: content_for(item, 'Action'),
  barrel: content_for(item, 'Barrel'),
  capacity: content_for(item, 'Capacity'),
  finish: content_for(item, 'Finish'),
  length: content_for(item, 'Length'),
  receiver: content_for(item, 'Receiver'),
  safety: content_for(item, 'Safety'),
  sights: content_for(item, 'Sights'),
  stock_frame_grips: content_for(item, 'StockFrameGrips'),
  magazine: content_for(item, 'Magazine'),
  weight: content_for(item, 'Weight'),
  image: "http://www.lipseys.net/images/#{content_for(item, 'Image')}",
  chamber: content_for(item, 'Chamber'),
  drilled_tapped: (content_for(item, 'DrilledTapped') == 'Y'),
  rate_of_twist: content_for(item, 'RateOfTwist'),
  item_type: content_for(item, 'ItemType'),
  feature_1: content_for(item, 'Feature1'),
  feature_2: content_for(item, 'Feature2'),
  feature_3: content_for(item, 'Feature3'),
  shipping_weight: content_for(item, 'ShippingWeight'),
  bound_book: {
    model: content_for(item, 'BoundBookModel'),
    type: content_for(item, 'BoundBookType'),
    manufacturer: content_for(item, 'BoundBookMFG'),
  },
  nfa: {
    thread_pattern: content_for(item, 'NFAThreadPattern'),
    attach_method: content_for(item, 'NFAAttachMethod'),
    baffle: content_for(item, 'NFABaffle'),
    can_disassemble: (content_for(item, 'NFACanDisassemble') == 'Y'),
    construction: content_for(item, 'NFAConstruction'),
    db_reduction: content_for(item, 'NFAdbReduction'),
    diameter: content_for(item, 'NFADiameter'),
    form_3_caliber: content_for(item, 'NFAForm3Caliber'),
  },
  optic: {
    magnification: content_for(item, 'Magnification'),
    maintube: content_for(item, 'Maintube'),
    objective: content_for(item, 'Objective'),
    adjustable_objective: (content_for(item, 'AdjustableObjective') == 'Y'),
    optic_adjustments: content_for(item, 'OpticAdjustments'),
    reticle: content_for(item, 'Reticle'),
    illuminated_reticle: (content_for(item, 'IlluminatedReticle') == 'Y'),
  }
}

Constant Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Catalog

Returns a new instance of Catalog.



65
66
67
68
69
# File 'lib/lipseys/catalog.rb', line 65

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

Class Method Details

.accessories(options = {}) ⇒ Object



104
105
106
# File 'lib/lipseys/catalog.rb', line 104

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

.all(options = {}) ⇒ Object



72
73
74
# File 'lib/lipseys/catalog.rb', line 72

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

.firearms(options = {}) ⇒ Object



80
81
82
# File 'lib/lipseys/catalog.rb', line 80

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

.nfa(options = {}) ⇒ Object



88
89
90
# File 'lib/lipseys/catalog.rb', line 88

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

.optics(options = {}) ⇒ Object



96
97
98
# File 'lib/lipseys/catalog.rb', line 96

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

Instance Method Details

#accessoriesObject



108
109
110
# File 'lib/lipseys/catalog.rb', line 108

def accessories
  get_items('ACCESSORY')
end

#allObject



76
77
78
# File 'lib/lipseys/catalog.rb', line 76

def all
  get_items
end

#firearmsObject



84
85
86
# File 'lib/lipseys/catalog.rb', line 84

def firearms
  get_items('FIREARM')
end

#nfaObject



92
93
94
# File 'lib/lipseys/catalog.rb', line 92

def nfa
  get_items('NFA')
end

#opticsObject



100
101
102
# File 'lib/lipseys/catalog.rb', line 100

def optics
  get_items('OPTIC')
end