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 +4 -4
- data/lib/davidsons/inventory.rb +34 -0
- data/lib/davidsons/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0840c1274babcf9eb57a4ef24f84931ee3693e7a
|
4
|
+
data.tar.gz: 053ab73ab4258594104732a3e943111202da2383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445dd946ba77bf28ae1e6bb7b78f7033ad1aa3aeedc1ec5c42d9788be5790aa93bf3aa076d6879c2fd50baf12052d674887f83155550d1859afa9d82317c81cc
|
7
|
+
data.tar.gz: d0ab4bec018a56e335753e9951da13ef6516066d592ee7ad16faa1f47240d074a40db1a8b62907fc6fc37308f91fd1a0c68ea9934207ee34db7b91f653ab485c
|
data/lib/davidsons/inventory.rb
CHANGED
@@ -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)
|
data/lib/davidsons/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|