rsr_group 2.2.0 → 2.2.1
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 +4 -4
- data/lib/rsr_group/inventory.rb +42 -3
- data/lib/rsr_group/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: a8b2ec538c829b5cdd5337c4daff8498ff5a68f8
|
4
|
+
data.tar.gz: 7ca678d75d29821fc5c3d667a57b453d26107d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 675917f7dd8813979a9f744cd87f27112c2f8f2073c4d5a0a909cb34c187d880ff4e52049d2ff9f9c20c8c862de6af6e7c349f2962637dfe216d64d2b29045e5
|
7
|
+
data.tar.gz: 246c0795dcca757b3171759cabf30092c4a78fe64a4aaad45fedbfd4e471cdd7c0a1ef6c67d4f5e1249e57b571312229da495aa63f087e18c44a89fd8afc5278
|
data/lib/rsr_group/inventory.rb
CHANGED
@@ -29,6 +29,16 @@ module RsrGroup
|
|
29
29
|
@options = options
|
30
30
|
end
|
31
31
|
|
32
|
+
def self.get_quantity_file(options = {})
|
33
|
+
requires!(options, :username, :password)
|
34
|
+
new(options).get_quantity_file
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.quantity(chunk_size, options = {}, &block)
|
38
|
+
requires!(options, :username, :password)
|
39
|
+
new(options).quantity(chunk_size, &block)
|
40
|
+
end
|
41
|
+
|
32
42
|
def self.all(chunk_size, options = {}, &block)
|
33
43
|
requires!(options, :username, :password)
|
34
44
|
new(options).all(chunk_size, &block)
|
@@ -58,9 +68,38 @@ module RsrGroup
|
|
58
68
|
end
|
59
69
|
end
|
60
70
|
|
61
|
-
def
|
62
|
-
|
63
|
-
|
71
|
+
def get_quantity_file
|
72
|
+
connect(@options) do |ftp|
|
73
|
+
quantity_tempfile = Tempfile.new
|
74
|
+
tempfile = Tempfile.new
|
75
|
+
|
76
|
+
# Is this a key dealer?
|
77
|
+
if ftp.nlst.include?(KEYDEALER_DIR)
|
78
|
+
ftp.chdir(KEYDEALER_DIR)
|
79
|
+
# Pull from the FTP and save as a temp file
|
80
|
+
ftp.getbinaryfile(QTY_FILENAME, quantity_tempfile.path)
|
81
|
+
else
|
82
|
+
ftp.chdir(INVENTORY_DIR)
|
83
|
+
# Pull from the FTP and save as a temp file
|
84
|
+
ftp.getbinaryfile(QTY_FILENAME, quantity_tempfile.path)
|
85
|
+
end
|
86
|
+
|
87
|
+
SmarterCSV.process(quantity_tempfile.open, {
|
88
|
+
chunk_size: 100,
|
89
|
+
force_utf8: true,
|
90
|
+
convert_values_to_numeric: false,
|
91
|
+
user_provided_headers: [:item_identifier, :quantity]
|
92
|
+
}) do |chunk|
|
93
|
+
chunk.each do |item|
|
94
|
+
tempfile.puts("#{item[:item_identifier]}, #{item[:quantity]}")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
quantity_tempfile.unlink
|
99
|
+
ftp.close
|
100
|
+
|
101
|
+
tempfile.path
|
102
|
+
end
|
64
103
|
end
|
65
104
|
|
66
105
|
def quantity(chunk_size, &block)
|
data/lib/rsr_group/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsr_group
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
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-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smarter_csv
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.5.1
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: RSR Group Ruby library
|