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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccaad0063b9304473697f5bc0f74c8d7a8689181
4
- data.tar.gz: 6fb727e744a3e84a1f0def6228ca3ffd9eca4b95
3
+ metadata.gz: 311a253d2608e8d5648758211a8455b7a700b082
4
+ data.tar.gz: 94beb0521f23d3987f965b953265dfa7f7eadad9
5
5
  SHA512:
6
- metadata.gz: 062fdc2e61ebd2b37b80f87811ad2f323f63b147eaedfc9d20496e165260e667128c1218d05cdde8812ff5d34298134ec35638f53ec86ee456a34f443009b9e5
7
- data.tar.gz: 398e236379f58c09762b833471a2efb16386346a11737391e44f09f0b2a27f61b3e1b2be78aa415878fd9f96e506fb6d8946c69b8ea626936cbd3e78e5861caf
6
+ metadata.gz: 1ff8318e9afd8bbb3c4ec64182e3060d55723bd7c0ac41735c85198d8d6c984d009d49a420f488d5a6e9a3f94f98e08fb46f57f0edcee2e440ba3d3c1c6add73
7
+ data.tar.gz: 6206211017a9fbf4a98d7874353c0a60e6bfc483fa11f1443bfdcf2e1ad1beb3713d3dc2da7747708535cfc08e88e7b9f6174b9c55b65a4a4792596ac58808c8
@@ -2,19 +2,15 @@ module BillHicks
2
2
  # Catalog item response structure:
3
3
  #
4
4
  # {
5
- # product_name: "...",
6
- # universal_product_code: "...",
7
- # short_description: "...",
8
- # long_description: "...",
9
- # category_code: "...",
10
- # category_description: "...",
11
- # product_price: "...",
12
- # small_image_path: "...",
13
- # large_image_path: "...",
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
- csv_tempfile = Tempfile.new
56
+ tempfile = Tempfile.new
61
57
 
62
58
  ftp.chdir(BillHicks.config.top_level_dir)
63
- ftp.getbinaryfile(CATALOG_FILENAME, csv_tempfile.path)
59
+ ftp.getbinaryfile(CATALOG_FILENAME, tempfile.path)
64
60
 
65
- SmarterCSV.process(csv_tempfile, {
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
- mfg_number = item[:name].split.last
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] = 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
 
@@ -23,18 +23,18 @@ module BillHicks
23
23
  def all(chunk_size, &block)
24
24
  connect(@options) do |ftp|
25
25
  begin
26
- csv_tempfile = Tempfile.new
26
+ tempfile = Tempfile.new
27
27
 
28
28
  ftp.chdir(BillHicks.config.top_level_dir)
29
- ftp.getbinaryfile(INVENTORY_FILENAME, csv_tempfile.path)
29
+ ftp.getbinaryfile(INVENTORY_FILENAME, tempfile.path)
30
30
 
31
- SmarterCSV.process(csv_tempfile, {
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
@@ -1,3 +1,3 @@
1
1
  module BillHicks
2
- VERSION = '2.0.8'.freeze
2
+ VERSION = '2.0.9'.freeze
3
3
  end
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.8
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-02 00:00:00.000000000 Z
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.5.1
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