bill_hicks 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +41 -0
- data/.ruby-version +1 -1
- data/README.md +0 -89
- data/lib/bill_hicks/catalog.rb +8 -4
- data/lib/bill_hicks/version.rb +1 -1
- metadata +3 -3
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 945f056addae566f3a420381231701f1a46af088
|
4
|
+
data.tar.gz: f1ecd4b082c1c75e4094f9eb28052905afa0afd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f9d389ac08f36b262e4c2d9df438977cfb1224784e7574916bc8ba0eeed71b30e17938a4c036bb25edc15ab493f909eaf4280b9a0be2e12e297b148724f9109
|
7
|
+
data.tar.gz: 2b88bd1e0796056326dfcac5814e6d916490298ddc696a88735b16d581a695fa710578f77aa8b5504f76b3e1ece2c9dc9b5e765deb511bb3191752af0668d72f
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
+
|
12
|
+
working_directory: ~/repo
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
# Download and cache dependencies
|
18
|
+
- restore_cache:
|
19
|
+
keys:
|
20
|
+
- v1-dependencies-{{ checksum "bill_hicks.gemspec" }}
|
21
|
+
# fallback to using the latest cache if no exact match is found
|
22
|
+
- v1-dependencies-
|
23
|
+
|
24
|
+
- run:
|
25
|
+
name: install dependencies
|
26
|
+
command: |
|
27
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
28
|
+
|
29
|
+
- save_cache:
|
30
|
+
paths:
|
31
|
+
- ./vendor/bundle
|
32
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
33
|
+
|
34
|
+
# run tests!
|
35
|
+
- run:
|
36
|
+
name: run tests
|
37
|
+
command: |
|
38
|
+
mkdir /tmp/test-results
|
39
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
40
|
+
|
41
|
+
bundle exec rspec --format documentation $TEST_FILES
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.6
|
data/README.md
CHANGED
@@ -18,95 +18,6 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install bill_hicks
|
20
20
|
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
**Note:** Nearly all methods require `:username` and `:password` keys in the options hash.
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
options = {
|
27
|
-
username: 'dealer@example.com',
|
28
|
-
password: 'sekret-passwd'
|
29
|
-
}
|
30
|
-
```
|
31
|
-
|
32
|
-
### BillHicks::Catalog
|
33
|
-
|
34
|
-
To get all items in the catalog:
|
35
|
-
|
36
|
-
```ruby
|
37
|
-
catalog = BillHicks::Catalog.all(options)
|
38
|
-
```
|
39
|
-
|
40
|
-
See `BillHicks::Catalog` for the response structure.
|
41
|
-
|
42
|
-
### BillHicks::Inventory
|
43
|
-
|
44
|
-
To get your inventory details (availability, price, etc.):
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
inventory = BillHicks::Inventory.all(options)
|
48
|
-
```
|
49
|
-
|
50
|
-
See `BillHicks::Inventory` for the response structure.
|
51
|
-
|
52
|
-
### BillHicks::Category
|
53
|
-
|
54
|
-
Returns an array of category codes and descriptions.
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
categories = BillHicks::Category.all(options)
|
58
|
-
|
59
|
-
# [
|
60
|
-
# {:code=>"H648", :description=>"AIRGUNS"},
|
61
|
-
# {:code=>"H610", :description=>"AMMUNITION"},
|
62
|
-
# ...,
|
63
|
-
# ]
|
64
|
-
```
|
65
|
-
|
66
|
-
### BillHicks::Order
|
67
|
-
|
68
|
-
To build and submit an order, the basic steps are: 1) instantiate an Order object, 2) add header
|
69
|
-
information, 3) add item information (multiple items if needed), 4) submit the order.
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
# Instantiate the Order instance, passing in your :username and :password
|
73
|
-
order = BillHicks::Order.new(options)
|
74
|
-
|
75
|
-
# Add header information:
|
76
|
-
header_opts = {
|
77
|
-
customer: '...', # customer number
|
78
|
-
purchase_order: '...', # application specific purchase order
|
79
|
-
ffl: '...', # your FFL number
|
80
|
-
shipping: { # shipping information (all fields except :address_2 are required)
|
81
|
-
name: '...',
|
82
|
-
address_1: '...',
|
83
|
-
address_2: '...',
|
84
|
-
city: '...',
|
85
|
-
state: '...',
|
86
|
-
zip: '...',
|
87
|
-
},
|
88
|
-
|
89
|
-
# Optional fields:
|
90
|
-
shipping_method: '...',
|
91
|
-
notes: '...',
|
92
|
-
}
|
93
|
-
order.add_header(header_opts)
|
94
|
-
|
95
|
-
# Add item information:
|
96
|
-
item_opts = {
|
97
|
-
item_number: '...', # Bill Hicks item number
|
98
|
-
description: '...',
|
99
|
-
quantity: 1,
|
100
|
-
price: '123.45', # Decimal formatted price, without currency sign
|
101
|
-
}
|
102
|
-
order.add_item(item_opts) # Multiple items may be added, just call #add_item for each one.
|
103
|
-
|
104
|
-
# Submit the order (returns true on success, raises an exception on failgure):
|
105
|
-
order.submit!
|
106
|
-
```
|
107
|
-
|
108
|
-
See `BillHicks::Order` for details on required options.
|
109
|
-
|
110
21
|
## Development
|
111
22
|
|
112
23
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/bill_hicks/catalog.rb
CHANGED
@@ -47,12 +47,14 @@ module BillHicks
|
|
47
47
|
@options = options
|
48
48
|
end
|
49
49
|
|
50
|
-
def self.all(options = {}
|
50
|
+
def self.all(options = {})
|
51
51
|
requires!(options, :username, :password)
|
52
|
-
new(options).all
|
52
|
+
new(options).all
|
53
53
|
end
|
54
54
|
|
55
|
-
def all
|
55
|
+
def all
|
56
|
+
items = []
|
57
|
+
|
56
58
|
connect(@options) do |ftp|
|
57
59
|
tempfile = Tempfile.new
|
58
60
|
|
@@ -89,12 +91,14 @@ module BillHicks
|
|
89
91
|
item[:features] = features
|
90
92
|
end
|
91
93
|
|
92
|
-
|
94
|
+
items << item
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
96
98
|
tempfile.unlink
|
97
99
|
end
|
100
|
+
|
101
|
+
items
|
98
102
|
end
|
99
103
|
|
100
104
|
protected
|
data/lib/bill_hicks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bill_hicks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smarter_csv
|
@@ -87,11 +87,11 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".circleci/config.yml"
|
90
91
|
- ".gitignore"
|
91
92
|
- ".rspec"
|
92
93
|
- ".ruby-gemset"
|
93
94
|
- ".ruby-version"
|
94
|
-
- ".travis.yml"
|
95
95
|
- Gemfile
|
96
96
|
- LICENSE.txt
|
97
97
|
- README.md
|