bill_hicks 2.0.2 → 2.0.3
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/lib/bill_hicks/brand_converter.rb +1 -0
- data/lib/bill_hicks/catalog.rb +35 -11
- data/lib/bill_hicks/inventory.rb +6 -6
- data/lib/bill_hicks/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 155acae5b04bdd77b8d7ad3fb20d201cf3e4fc94
|
|
4
|
+
data.tar.gz: 21a190ddffe89a499c5467d8defdcf85d941c288
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 37e3d2538511d4f71b2aad19b20d1c2eb69adb037c3a7c96fbe1bfc77c898cd5040bbe2d7b4dc109aafc8f1bbbf38e3dd020c4a5d552778d973b78ed2ddc7fed
|
|
7
|
+
data.tar.gz: ce82c3a96c767dab6623b09cf543c370cc92f6062c5f183101ec318a68f08d69a2f3930280db9a0a1f4ed2dad2edd7d667c8da7367b9bad2a36e8daf87a40fe8
|
|
@@ -328,6 +328,7 @@ module BillHicks
|
|
|
328
328
|
{ prefix: 'SML', company: 'Standard Manufacturing Company' },
|
|
329
329
|
{ prefix: 'STOP', company: 'Phalanx Defense Systems' },
|
|
330
330
|
{ prefix: 'STEYR', company: 'Steyr Arms' },
|
|
331
|
+
{ prefix: 'STY', company: 'Styrka' },
|
|
331
332
|
{ prefix: 'STORM', company: 'Pelican Storm Cases' },
|
|
332
333
|
{ prefix: 'STREAM', company: 'Streamlight' },
|
|
333
334
|
{ prefix: 'SUN', company: 'Sun Optics' },
|
data/lib/bill_hicks/catalog.rb
CHANGED
|
@@ -19,6 +19,31 @@ module BillHicks
|
|
|
19
19
|
class Catalog < Base
|
|
20
20
|
|
|
21
21
|
CATALOG_FILENAME = 'billhickscatalog.csv'
|
|
22
|
+
PERMITTED_FEATURES = [
|
|
23
|
+
'weight',
|
|
24
|
+
'caliber',
|
|
25
|
+
'action',
|
|
26
|
+
'mount',
|
|
27
|
+
'finish',
|
|
28
|
+
'length',
|
|
29
|
+
'diameter',
|
|
30
|
+
'rail',
|
|
31
|
+
'trigger',
|
|
32
|
+
'barrel length',
|
|
33
|
+
'silencer mount',
|
|
34
|
+
'barrel',
|
|
35
|
+
'stock',
|
|
36
|
+
'internal bore',
|
|
37
|
+
'thread pitch',
|
|
38
|
+
'dimensions',
|
|
39
|
+
'bulb type',
|
|
40
|
+
'bezel diameter',
|
|
41
|
+
'output max',
|
|
42
|
+
'battery type',
|
|
43
|
+
'mount type',
|
|
44
|
+
'waterproof rating',
|
|
45
|
+
'operating temperature'
|
|
46
|
+
]
|
|
22
47
|
|
|
23
48
|
def initialize(options = {})
|
|
24
49
|
requires!(options, :username, :password)
|
|
@@ -38,15 +63,15 @@ module BillHicks
|
|
|
38
63
|
ftp.getbinaryfile(CATALOG_FILENAME, csv_tempfile.path)
|
|
39
64
|
|
|
40
65
|
SmarterCSV.process(csv_tempfile, {
|
|
41
|
-
:
|
|
42
|
-
:
|
|
43
|
-
:
|
|
44
|
-
:
|
|
45
|
-
:
|
|
46
|
-
:
|
|
47
|
-
:
|
|
48
|
-
:
|
|
49
|
-
:
|
|
66
|
+
chunk_size: chunk_size,
|
|
67
|
+
force_utf8: true,
|
|
68
|
+
convert_values_to_numeric: false,
|
|
69
|
+
key_mapping: {
|
|
70
|
+
universal_product_code: :upc,
|
|
71
|
+
product_name: :name,
|
|
72
|
+
product_weight: :weight,
|
|
73
|
+
product_price: :price,
|
|
74
|
+
category_description: :category
|
|
50
75
|
}
|
|
51
76
|
}) do |chunk|
|
|
52
77
|
chunk.each do |item|
|
|
@@ -90,7 +115,6 @@ module BillHicks
|
|
|
90
115
|
def parse_features(text)
|
|
91
116
|
features = Hash.new
|
|
92
117
|
text = text.split("-")
|
|
93
|
-
permitted_features = ['weight', 'caliber', 'action', 'mount', 'finish', 'length', 'diameter', 'rail', 'trigger', 'barrel length', 'silencer mount', 'barrel', 'stock', 'internal bore', 'thread pitch', 'dimensions', 'bulb type', 'bezel diameter', 'output max', 'battery type', 'mount type', 'waterproof rating', 'operating temperature']
|
|
94
118
|
|
|
95
119
|
text.each do |feature|
|
|
96
120
|
if feature.include?(':') && feature.length <= 45
|
|
@@ -102,7 +126,7 @@ module BillHicks
|
|
|
102
126
|
|
|
103
127
|
key, value = key.strip.downcase, value.strip
|
|
104
128
|
|
|
105
|
-
if
|
|
129
|
+
if PERMITTED_FEATURES.include?(key)
|
|
106
130
|
features[key.gsub(" ", "_")] = value
|
|
107
131
|
end
|
|
108
132
|
end
|
data/lib/bill_hicks/inventory.rb
CHANGED
|
@@ -29,12 +29,12 @@ module BillHicks
|
|
|
29
29
|
ftp.getbinaryfile(INVENTORY_FILENAME, csv_tempfile.path)
|
|
30
30
|
|
|
31
31
|
SmarterCSV.process(csv_tempfile, {
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:
|
|
35
|
-
:
|
|
36
|
-
:
|
|
37
|
-
|
|
32
|
+
chunk_size: chunk_size,
|
|
33
|
+
force_utf8: true,
|
|
34
|
+
convert_values_to_numeric: false,
|
|
35
|
+
key_mapping: {
|
|
36
|
+
qty_avail: :quantity,
|
|
37
|
+
upc: :item_identifier
|
|
38
38
|
}
|
|
39
39
|
}) do |chunk|
|
|
40
40
|
chunk.each do |item|
|
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: 2.0.
|
|
4
|
+
version: 2.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dale Campbell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: smarter_csv
|
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
115
115
|
version: '0'
|
|
116
116
|
requirements: []
|
|
117
117
|
rubyforge_project:
|
|
118
|
-
rubygems_version: 2.
|
|
118
|
+
rubygems_version: 2.6.12
|
|
119
119
|
signing_key:
|
|
120
120
|
specification_version: 4
|
|
121
121
|
summary: Ruby library for Bill Hicks ERP system
|