lipseys 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +100 -1
- data/lib/lipseys/catalog.rb +58 -0
- data/lib/lipseys/inventory.rb +12 -0
- data/lib/lipseys/invoice.rb +26 -0
- data/lib/lipseys/order.rb +13 -2
- data/lib/lipseys/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab57eb9fa2c0803b7af43f27d10b63b1fd7055c9
|
4
|
+
data.tar.gz: 5fad1f099f209fdaa967cb6395fb9cf4537b36cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a561fcb032e9a1aa544f055c15cdebbcefefd9c9ca6a7d6069e7027171e1b226bb6114aedc4cff39e94f0559088998b9b1830ff5c143fbf27c461414f08f5e3
|
7
|
+
data.tar.gz: 6bed03afd616a07b957a2cf61124f4f84a155085ac610c4aa5b99313a0970ebac8cf46a3a7e85d76acb6629d8da3dc9868e690f64335df8aca15dc7271fa4372
|
data/README.md
CHANGED
@@ -20,7 +20,106 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
**Note**: Nearly all methods require `:email` and `:password` keys in the options hash.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
options = {
|
27
|
+
email: 'dealer@example.com',
|
28
|
+
password: 'sekret-passwd'
|
29
|
+
}
|
30
|
+
```
|
31
|
+
|
32
|
+
### Lipseys::Catalog
|
33
|
+
|
34
|
+
There are several methods you can use to fetch different kinds (or all) items in the catalog.
|
35
|
+
All of the listed methods return the same response structure. See Lipseys::Catalog for details.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# All items
|
39
|
+
catalog = Lipseys::Catalog.all(options)
|
40
|
+
|
41
|
+
# Firearms only
|
42
|
+
firearms = Lipseys::Catalog.firearms(options)
|
43
|
+
|
44
|
+
# NFA / Class 3 items only
|
45
|
+
nfa = Lipseys::Catalog.nfa(options)
|
46
|
+
|
47
|
+
# Optics only
|
48
|
+
optics = Lipseys::Catalog.optics(options)
|
49
|
+
|
50
|
+
# Accessories only
|
51
|
+
accessories = Lipseys::Catalog.accessories(options)
|
52
|
+
```
|
53
|
+
|
54
|
+
### Lipseys::Inventory
|
55
|
+
|
56
|
+
There are similar methods for getting your account's inventory (availability, price, etc.).
|
57
|
+
All methods return the same response structure. See Lipseys::Inventory for details.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
inventory = Lipseys::Inventory.all(options)
|
61
|
+
firearms = Lipseys::Inventory.firearms(options)
|
62
|
+
nfa = Lipseys::Inventory.nfa(options)
|
63
|
+
optics = Lipseys::Inventory.optics(options)
|
64
|
+
accessories = Lipseys::Inventory.accessories(options)
|
65
|
+
```
|
66
|
+
|
67
|
+
### Lipseys::Order
|
68
|
+
|
69
|
+
In addition to the `:email` and `:password` keys in the options hash, submitting an order requires
|
70
|
+
the following params:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
options = {
|
74
|
+
email: 'dealer@example.com',
|
75
|
+
password: 'sekret-passwd',
|
76
|
+
|
77
|
+
item_number: '...', # Lipsey's item number
|
78
|
+
# - OR -
|
79
|
+
upc: '...', # Universal Product Code
|
80
|
+
|
81
|
+
quantity: 1,
|
82
|
+
purchase_order: 'PO-123', # Application specific Purchase Order
|
83
|
+
|
84
|
+
# Optional order params:
|
85
|
+
notify_by_email: true, # If you want an email sent when the order is created
|
86
|
+
note: '...', # Any notes attached to the order
|
87
|
+
}
|
88
|
+
|
89
|
+
response = Lipseys::Order.submit!(options)
|
90
|
+
```
|
91
|
+
|
92
|
+
The response will have this structure: (See Lipseys::Order for more details)
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
{
|
96
|
+
order_number: '...',
|
97
|
+
new_order: (true/false),
|
98
|
+
success: (true/false),
|
99
|
+
description: '...',
|
100
|
+
quantity_received: Integer,
|
101
|
+
}
|
102
|
+
```
|
103
|
+
|
104
|
+
### Lipseys::Invoice
|
105
|
+
|
106
|
+
In addition to the `:email` and `:password` keys in the options hash, finding an invoice requires
|
107
|
+
either an `:order_number` **OR** a `:purchase_order` param.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
options = {
|
111
|
+
email: 'dealer@example.com',
|
112
|
+
password: 'sekret-passwd',
|
113
|
+
|
114
|
+
order_number: '...', # Lipsey's order number
|
115
|
+
# - OR -
|
116
|
+
purchase_order: '...', # Application specific Purchase Order submitted with the order
|
117
|
+
}
|
118
|
+
|
119
|
+
invoice = Lipseys::Invoice.all(options)
|
120
|
+
```
|
121
|
+
|
122
|
+
See Lipseys::Invoice for the response structure details.
|
24
123
|
|
25
124
|
## Development
|
26
125
|
|
data/lib/lipseys/catalog.rb
CHANGED
@@ -1,4 +1,62 @@
|
|
1
1
|
module Lipseys
|
2
|
+
# Each method will return an array of catalog items with the following fields:
|
3
|
+
#
|
4
|
+
# {
|
5
|
+
# item_number: content_for(item, 'ItemNo'),
|
6
|
+
# description_1: content_for(item, 'Desc1'),
|
7
|
+
# description_2: content_for(item, 'Desc2'),
|
8
|
+
# upc: content_for(item, 'UPC'),
|
9
|
+
# manufacturer_model_number: content_for(item, 'MFGModelNo'),
|
10
|
+
# msrp: content_for(item, 'MSRP'),
|
11
|
+
# model: content_for(item, 'Model'),
|
12
|
+
# caliber: content_for(item, 'Caliber'),
|
13
|
+
# manufacturer: content_for(item, 'MFG'),
|
14
|
+
# type: content_for(item, 'Type'),
|
15
|
+
# action: content_for(item, 'Action'),
|
16
|
+
# barrel: content_for(item, 'Barrel'),
|
17
|
+
# capacity: content_for(item, 'Capacity'),
|
18
|
+
# finish: content_for(item, 'Finish'),
|
19
|
+
# length: content_for(item, 'Length'),
|
20
|
+
# receiver: content_for(item, 'Receiver'),
|
21
|
+
# safety: content_for(item, 'Safety'),
|
22
|
+
# sights: content_for(item, 'Sights'),
|
23
|
+
# stock_frame_grips: content_for(item, 'StockFrameGrips'),
|
24
|
+
# magazine: content_for(item, 'Magazine'),
|
25
|
+
# weight: content_for(item, 'Weight'),
|
26
|
+
# image: "http://www.lipseys.net/images/#{content_for(item, 'Image')}",
|
27
|
+
# chamber: content_for(item, 'Chamber'),
|
28
|
+
# drilled_tapped: (content_for(item, 'DrilledTapped') == 'Y'),
|
29
|
+
# rate_of_twist: content_for(item, 'RateOfTwist'),
|
30
|
+
# item_type: content_for(item, 'ItemType'),
|
31
|
+
# feature_1: content_for(item, 'Feature1'),
|
32
|
+
# feature_2: content_for(item, 'Feature2'),
|
33
|
+
# feature_3: content_for(item, 'Feature3'),
|
34
|
+
# shipping_weight: content_for(item, 'ShippingWeight'),
|
35
|
+
# bound_book: {
|
36
|
+
# model: content_for(item, 'BoundBookModel'),
|
37
|
+
# type: content_for(item, 'BoundBookType'),
|
38
|
+
# manufacturer: content_for(item, 'BoundBookMFG'),
|
39
|
+
# },
|
40
|
+
# nfa: {
|
41
|
+
# thread_pattern: content_for(item, 'NFAThreadPattern'),
|
42
|
+
# attach_method: content_for(item, 'NFAAttachMethod'),
|
43
|
+
# baffle: content_for(item, 'NFABaffle'),
|
44
|
+
# can_disassemble: (content_for(item, 'NFACanDisassemble') == 'Y'),
|
45
|
+
# construction: content_for(item, 'NFAConstruction'),
|
46
|
+
# db_reduction: content_for(item, 'NFAdbReduction'),
|
47
|
+
# diameter: content_for(item, 'NFADiameter'),
|
48
|
+
# form_3_caliber: content_for(item, 'NFAForm3Caliber'),
|
49
|
+
# },
|
50
|
+
# optic: {
|
51
|
+
# magnification: content_for(item, 'Magnification'),
|
52
|
+
# maintube: content_for(item, 'Maintube'),
|
53
|
+
# objective: content_for(item, 'Objective'),
|
54
|
+
# adjustable_objective: (content_for(item, 'AdjustableObjective') == 'Y'),
|
55
|
+
# optic_adjustments: content_for(item, 'OpticAdjustments'),
|
56
|
+
# reticle: content_for(item, 'Reticle'),
|
57
|
+
# illuminated_reticle: (content_for(item, 'IlluminatedReticle') == 'Y'),
|
58
|
+
# }
|
59
|
+
# }
|
2
60
|
class Catalog < Base
|
3
61
|
|
4
62
|
API_URL = 'https://www.lipseys.com/API/catalog.ashx'
|
data/lib/lipseys/inventory.rb
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
module Lipseys
|
2
|
+
# Each method will return an array of inventory items with the following fields:
|
3
|
+
#
|
4
|
+
# {
|
5
|
+
# item_number: content_for(item, 'ItemNo'),
|
6
|
+
# upc: content_for(item, 'UPC'),
|
7
|
+
# manufacturer_model_number: content_for(item, 'MFGModelNo'),
|
8
|
+
# quantity_on_hand: content_for(item, 'QtyOnHand'),
|
9
|
+
# allocation: (content_for(item, 'Allocation') == 'Y'),
|
10
|
+
# price: content_for(item, 'Price'),
|
11
|
+
# on_sale: (content_for(item, 'OnSale') == 'Y'),
|
12
|
+
# retail_map: content_for(item, 'RetailMAP')
|
13
|
+
# }
|
2
14
|
class Inventory < Base
|
3
15
|
|
4
16
|
API_URL = 'https://www.lipseys.com/API/pricequantitycatalog.ashx'
|
data/lib/lipseys/invoice.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
module Lipseys
|
2
|
+
# In addition to the `:email` and `:password` options, finding invoices requires
|
3
|
+
# either an `:order_number` **OR** a `:purchase_order`.
|
2
4
|
class Invoice < SoapClient
|
3
5
|
|
4
6
|
def initialize(options = {})
|
@@ -16,6 +18,30 @@ module Lipseys
|
|
16
18
|
new(*args).all
|
17
19
|
end
|
18
20
|
|
21
|
+
# The response structure will look like this:
|
22
|
+
#
|
23
|
+
# {
|
24
|
+
# invoices_found: 1,
|
25
|
+
# description: "1 Invoice(s) found.",
|
26
|
+
# invoices: {
|
27
|
+
# invoice_detail: {
|
28
|
+
# invoice_no: "...",
|
29
|
+
# ship_to_location: "...",
|
30
|
+
# tracking_no: "...",
|
31
|
+
# line_items: {
|
32
|
+
# item_detail: {
|
33
|
+
# item_no: "...",
|
34
|
+
# upc: "...",
|
35
|
+
# qty: "...",
|
36
|
+
# serialized_item: "...",
|
37
|
+
# serial_numbers: {
|
38
|
+
# string: "..."
|
39
|
+
# }
|
40
|
+
# }
|
41
|
+
# }
|
42
|
+
# }
|
43
|
+
# }
|
44
|
+
# }
|
19
45
|
def all
|
20
46
|
response = soap_client.call(:get_invoices, message: build_inquiry_data)
|
21
47
|
|
data/lib/lipseys/order.rb
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
module Lipseys
|
2
|
+
# Required options when submitting an order:
|
3
|
+
#
|
4
|
+
# * `:email` and `:password`
|
5
|
+
# * `:item_number` OR `:upc`
|
6
|
+
# * `:quantity`
|
7
|
+
# * `:purchase_order`
|
8
|
+
#
|
9
|
+
# Optional order params:
|
10
|
+
#
|
11
|
+
# * `:notify_by_email` (boolean)
|
12
|
+
# * `:note`
|
2
13
|
class Order < SoapClient
|
3
14
|
|
4
15
|
def initialize(options = {})
|
@@ -17,10 +28,10 @@ module Lipseys
|
|
17
28
|
|
18
29
|
|
19
30
|
def self.submit(*args)
|
20
|
-
new(*args).submit
|
31
|
+
new(*args).submit!
|
21
32
|
end
|
22
33
|
|
23
|
-
def submit
|
34
|
+
def submit!
|
24
35
|
response = soap_client.call(:submit_order, message: build_order_data)
|
25
36
|
|
26
37
|
raise Lipseys::NotAuthenticated if not_authenticated?(response)
|
data/lib/lipseys/version.rb
CHANGED