mge_wholesale 1.0.4 → 3.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mge_wholesale/inventory.rb +21 -31
- data/lib/mge_wholesale/version.rb +1 -1
- data/lib/mge_wholesale.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7463a0e2032a6bd9056bc5b1979793ad752d5c1c9327068e74bede719fa9bcf6
|
4
|
+
data.tar.gz: 7b5409d4d70b850bb24370cdb16626e487a8674933ffc882f9f2d690be553dd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d275c5d84cb7ec8d9ddd2767581e4fc05fc58aa3370447f93a09aca5ca1d2d74408ddd6cab116a63ca97d470caf01981cb721adae9b1bf5bba06e9fe6266e1dc
|
7
|
+
data.tar.gz: a181d5b70f864a943d8dd87e6d91aed4906d1da425a4e25053f4e36bd509f6a03db2616dc4cc5bddd08c3ec4718f3f8943ed65e7c99ae3773daa058cf90ecde9
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module MgeWholesale
|
2
2
|
class Inventory < Base
|
3
3
|
|
4
|
-
INVENTORY_FILENAME = 'exportXML_cq_barcodeFFL.
|
4
|
+
INVENTORY_FILENAME = 'exportXML_cq_barcodeFFL.csv'.freeze
|
5
|
+
FULL_INVENTORY_FILENAME = 'exportXML_cq_barcodeFFL_all.csv'.freeze
|
5
6
|
|
6
7
|
def initialize(options = {})
|
7
8
|
requires!(options, :username, :password)
|
@@ -13,51 +14,40 @@ module MgeWholesale
|
|
13
14
|
new(options).all(&block)
|
14
15
|
end
|
15
16
|
|
16
|
-
def self.get_quantity_file(options = {})
|
17
|
-
requires!(options, :username, :password)
|
18
|
-
new(options).get_quantity_file
|
19
|
-
end
|
20
|
-
|
21
17
|
def self.quantity(options = {}, &block)
|
22
18
|
requires!(options, :username, :password)
|
23
|
-
new(options).
|
19
|
+
new(options).quantity(&block)
|
24
20
|
end
|
25
21
|
|
26
22
|
def all(&block)
|
27
23
|
tempfile = get_file(INVENTORY_FILENAME)
|
28
24
|
|
29
|
-
|
30
|
-
|
25
|
+
CSV.foreach(tempfile, { headers: :first_row }).each do |row|
|
26
|
+
item = {
|
27
|
+
item_identifier: row['id'],
|
28
|
+
quantity: row['qty'].to_i,
|
29
|
+
price: row['cost'],
|
30
|
+
}
|
31
|
+
|
32
|
+
yield(item)
|
31
33
|
end
|
32
34
|
|
33
|
-
tempfile.close
|
34
35
|
tempfile.unlink
|
35
36
|
end
|
36
37
|
|
37
|
-
def
|
38
|
-
|
39
|
-
tempfile = Tempfile.new
|
38
|
+
def quantity(&block)
|
39
|
+
tempfile = get_file(FULL_INVENTORY_FILENAME)
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
CSV.foreach(tempfile, { headers: :first_row }).each do |row|
|
42
|
+
item = {
|
43
|
+
item_identifier: row['id'],
|
44
|
+
quantity: row['qty'].to_i,
|
45
|
+
}
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
tempfile.close
|
48
|
-
tempfile.path
|
49
|
-
end
|
50
|
-
|
51
|
-
alias quantity all
|
52
|
-
|
53
|
-
private
|
47
|
+
yield(item)
|
48
|
+
end
|
54
49
|
|
55
|
-
|
56
|
-
{
|
57
|
-
item_identifier: content_for(node, 'id'),
|
58
|
-
quantity: content_for(node, 'qty').to_i,
|
59
|
-
price: content_for(node, 'cost')
|
60
|
-
}
|
50
|
+
tempfile.unlink
|
61
51
|
end
|
62
52
|
|
63
53
|
end
|
data/lib/mge_wholesale.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mge_wholesale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Ebling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- - "
|
126
|
+
- - ">"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
128
|
+
version: 1.3.1
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
131
|
rubygems_version: 2.7.7
|