davidsons 1.0.0 → 1.0.1

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: 74e0b821b223121ce9a0307d67fbad936233fe05
4
- data.tar.gz: 2e5d000c3ab2104035e8ebc84a9b4341eac84bd3
3
+ metadata.gz: 0840c1274babcf9eb57a4ef24f84931ee3693e7a
4
+ data.tar.gz: 053ab73ab4258594104732a3e943111202da2383
5
5
  SHA512:
6
- metadata.gz: 3264a03c3d82a2f9f8409c1e4b42a02499cc5fdd2665c2fd5176f2612ac8379aed5236a093e2c221f3e9089a29aaf5fe61059927d061623eca38cf8659c4af90
7
- data.tar.gz: 5a8cb6c1f19bd0ff32a906147741304a05e4d8dac543afda0ffff4d86422819c2159bc7eff297fae81ad205b91194b3a4288d0ad1b27b4679ef580389d3537df
6
+ metadata.gz: 445dd946ba77bf28ae1e6bb7b78f7033ad1aa3aeedc1ec5c42d9788be5790aa93bf3aa076d6879c2fd50baf12052d674887f83155550d1859afa9d82317c81cc
7
+ data.tar.gz: d0ab4bec018a56e335753e9951da13ef6516066d592ee7ad16faa1f47240d074a40db1a8b62907fc6fc37308f91fd1a0c68ea9934207ee34db7b91f653ab485c
@@ -15,6 +15,11 @@ module Davidsons
15
15
  new(options).quantity(&block)
16
16
  end
17
17
 
18
+ def self.get_quantity_file(options = {})
19
+ requires!(options, :username, :password)
20
+ new(options).get_quantity_file
21
+ end
22
+
18
23
  def self.quantity(options = {}, &block)
19
24
  requires!(options, :username, :password)
20
25
  new(options).quantity(&block)
@@ -44,6 +49,35 @@ module Davidsons
44
49
  end
45
50
  end
46
51
 
52
+ def get_quantity_file
53
+ inventory_tempfile = get_file(INVENTORY_FILENAME)
54
+ tempfile = Tempfile.new
55
+
56
+ SmarterCSV.process(inventory_tempfile.open, {
57
+ chunk_size: CHUNK_SIZE,
58
+ convert_values_to_numeric: false,
59
+ force_utf8: true,
60
+ key_mapping: {
61
+ item_number: :item_identifier
62
+ }
63
+ }) do |chunk|
64
+ chunk.each do |item|
65
+ item.except!(:upc_code)
66
+
67
+ item[:quantity] = item[:quantity_nc].to_i + item[:quantity_az].to_i
68
+
69
+ item.except!(:quantity_nc, :quantity_az)
70
+
71
+ tempfile.puts("#{item[:item_number]},#{item[:quantity]}")
72
+ end
73
+ end
74
+
75
+ inventory_tempfile.unlink
76
+ tempfile.close
77
+
78
+ tempfile.path
79
+ end
80
+
47
81
  protected
48
82
 
49
83
  def map_location_quantities(item)
@@ -1,3 +1,3 @@
1
1
  module Davidsons
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davidsons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Knight
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon