bill_hicks 1.3.6 → 1.3.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aeac0daadb1a4b83b62eb8048b35eeb32da12c76
4
- data.tar.gz: 32f45f82c8339ab6b770f1ac37f48e7c2745e4cf
3
+ metadata.gz: a091c0d938afc4530512ed36c48075e64cbccc70
4
+ data.tar.gz: 2555b2a398bce03ccf50abb9d31caa0c42284437
5
5
  SHA512:
6
- metadata.gz: 60b950f3f3742834fc2a9620bf88cbee597f7cfcd5b059fdbe4daf4e5574ca3d9b825c61dbc35427baf5ec8820afe39ff6f8b7e52914e25b60b3c8f8fd3156f2
7
- data.tar.gz: a69ffb94cd6fb5f7dedc82012ab43ae316cc13b1f73c1e30b171e726b361a785ec8c31219ae3d41de11c1d650a91faf76c2f1225b7c3f01634261ba9b6212269
6
+ metadata.gz: a128ddc72c467f22ba103de7b9effc08273fbaa4380528471bdd69a0e2392c43af25554333779908920719ce252342b09020efa765d6b2a24c92171ee435202f
7
+ data.tar.gz: 88437c3a67446b7f63555e54515260511d971ebd2361f9cea6f9dee4757ce277e7487ff5c99d6e8e762f15a99822139f2a85e2498bcef3a209372d39f14d26a2
@@ -72,7 +72,14 @@ module BillHicks
72
72
  ftp.chdir(BillHicks.config.top_level_dir)
73
73
  ftp.getbinaryfile(CATALOG_FILENAME, tempfile.path)
74
74
 
75
- SmarterCSV.process(File.open(tempfile, "r:iso-8859-1"), { chunk_size: size, force_utf8: true, convert_values_to_numeric: false }) do |chunk|
75
+ smart_options = {
76
+ chunk_size: size,
77
+ key_mapping: { universal_product_code: :upc },
78
+ force_utf8: true,
79
+ convert_values_to_numeric: false
80
+ }
81
+
82
+ SmarterCSV.process(File.open(tempfile, "r:iso-8859-1"), smart_options) do |chunk|
76
83
  yield(chunk)
77
84
  end
78
85
 
@@ -52,20 +52,23 @@ module BillHicks
52
52
  # @size integer The number of items in each chunk
53
53
  def process_as_chunks(size, &block)
54
54
  connect(@options) do |ftp|
55
- temp_csv_file = Tempfile.new
55
+ tempfile = Tempfile.new
56
56
 
57
57
  ftp.chdir(BillHicks.config.top_level_dir)
58
- ftp.getbinaryfile(INVENTORY_FILENAME, temp_csv_file.path)
58
+ ftp.getbinaryfile(INVENTORY_FILENAME, tempfile.path)
59
59
 
60
- SmarterCSV.process(temp_csv_file, { :chunk_size => size, :force_utf8 => true, :convert_values_to_numeric => false, }) do |chunk|
61
- chunk.each do |item|
62
- item[:brand_name] = BillHicks::BrandConverter.convert(item[:product])
63
- end
60
+ smart_options = {
61
+ chunk_size: size,
62
+ key_mapping: { qty_avail: :quantity },
63
+ force_utf8: true,
64
+ convert_values_to_numeric: false
65
+ }
64
66
 
67
+ SmarterCSV.process(tempfile, smart_options) do |chunk|
65
68
  yield(chunk)
66
69
  end
67
70
 
68
- temp_csv_file.unlink
71
+ tempfile.unlink
69
72
  end
70
73
  end
71
74
 
@@ -1,3 +1,3 @@
1
1
  module BillHicks
2
- VERSION = '1.3.6'
2
+ VERSION = '1.3.7'.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: 1.3.6
4
+ version: 1.3.7
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-09-26 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smarter_csv