bill_hicks 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bill_hicks/catalog.rb +16 -20
- data/lib/bill_hicks/inventory.rb +5 -4
- 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: 311a253d2608e8d5648758211a8455b7a700b082
|
4
|
+
data.tar.gz: 94beb0521f23d3987f965b953265dfa7f7eadad9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ff8318e9afd8bbb3c4ec64182e3060d55723bd7c0ac41735c85198d8d6c984d009d49a420f488d5a6e9a3f94f98e08fb46f57f0edcee2e440ba3d3c1c6add73
|
7
|
+
data.tar.gz: 6206211017a9fbf4a98d7874353c0a60e6bfc483fa11f1443bfdcf2e1ad1beb3713d3dc2da7747708535cfc08e88e7b9f6174b9c55b65a4a4792596ac58808c8
|
data/lib/bill_hicks/catalog.rb
CHANGED
@@ -2,19 +2,15 @@ module BillHicks
|
|
2
2
|
# Catalog item response structure:
|
3
3
|
#
|
4
4
|
# {
|
5
|
-
# product_name:
|
6
|
-
#
|
7
|
-
# short_description:
|
8
|
-
# long_description:
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# product_weight: "...",
|
15
|
-
# marp: "...",
|
16
|
-
# msrp: "...",
|
17
|
-
# upc: "..." # alias of ':universal_product_code'
|
5
|
+
# product_name: "...",
|
6
|
+
# upc: "...",
|
7
|
+
# short_description: "...",
|
8
|
+
# long_description: "...",
|
9
|
+
# category: "...",
|
10
|
+
# price: "...",
|
11
|
+
# weight: "...",
|
12
|
+
# map: "...",
|
13
|
+
# msrp: "...",
|
18
14
|
# }
|
19
15
|
class Catalog < Base
|
20
16
|
|
@@ -57,12 +53,12 @@ module BillHicks
|
|
57
53
|
|
58
54
|
def all(chunk_size, &block)
|
59
55
|
connect(@options) do |ftp|
|
60
|
-
|
56
|
+
tempfile = Tempfile.new
|
61
57
|
|
62
58
|
ftp.chdir(BillHicks.config.top_level_dir)
|
63
|
-
ftp.getbinaryfile(CATALOG_FILENAME,
|
59
|
+
ftp.getbinaryfile(CATALOG_FILENAME, tempfile.path)
|
64
60
|
|
65
|
-
SmarterCSV.process(
|
61
|
+
SmarterCSV.process(tempfile, {
|
66
62
|
chunk_size: chunk_size,
|
67
63
|
force_utf8: true,
|
68
64
|
convert_values_to_numeric: false,
|
@@ -78,11 +74,9 @@ module BillHicks
|
|
78
74
|
chunk.each do |item|
|
79
75
|
item.except!(:category_code)
|
80
76
|
|
81
|
-
|
82
|
-
|
83
|
-
item[:item_identifier] = mfg_number
|
77
|
+
item[:item_identifier] = item[:name]
|
84
78
|
item[:brand] = BillHicks::BrandConverter.convert(item[:name])
|
85
|
-
item[:mfg_number] =
|
79
|
+
item[:mfg_number] = item[:name].split.last
|
86
80
|
|
87
81
|
if item[:long_description].present?
|
88
82
|
features = self.parse_features(item[:long_description])
|
@@ -111,6 +105,8 @@ module BillHicks
|
|
111
105
|
|
112
106
|
yield(chunk)
|
113
107
|
end
|
108
|
+
|
109
|
+
tempfile.unlink
|
114
110
|
end
|
115
111
|
end
|
116
112
|
|
data/lib/bill_hicks/inventory.rb
CHANGED
@@ -23,18 +23,18 @@ module BillHicks
|
|
23
23
|
def all(chunk_size, &block)
|
24
24
|
connect(@options) do |ftp|
|
25
25
|
begin
|
26
|
-
|
26
|
+
tempfile = Tempfile.new
|
27
27
|
|
28
28
|
ftp.chdir(BillHicks.config.top_level_dir)
|
29
|
-
ftp.getbinaryfile(INVENTORY_FILENAME,
|
29
|
+
ftp.getbinaryfile(INVENTORY_FILENAME, tempfile.path)
|
30
30
|
|
31
|
-
SmarterCSV.process(
|
31
|
+
SmarterCSV.process(tempfile, {
|
32
32
|
chunk_size: chunk_size,
|
33
33
|
force_utf8: true,
|
34
34
|
convert_values_to_numeric: false,
|
35
35
|
key_mapping: {
|
36
|
+
product: :item_identifier,
|
36
37
|
qty_avail: :quantity,
|
37
|
-
upc: :item_identifier
|
38
38
|
}
|
39
39
|
}) do |chunk|
|
40
40
|
chunk.each do |item|
|
@@ -44,6 +44,7 @@ module BillHicks
|
|
44
44
|
yield(chunk)
|
45
45
|
end
|
46
46
|
ensure
|
47
|
+
tempfile.unlink
|
47
48
|
ftp.close
|
48
49
|
end
|
49
50
|
end
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-03 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
|