rsr_group 4.0.0 → 5.0.0

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: 5aace14ec4f9b85ebf09c9d61ca97486a661cf48
4
- data.tar.gz: f34b435dd8a47cb6e6de99195f0209bc10630fa5
3
+ metadata.gz: 68eacaddc259cda0ac10b0a9ca68d3ed4af64560
4
+ data.tar.gz: ffdbfa6d964b758f438692f2bc33219960f5c09b
5
5
  SHA512:
6
- metadata.gz: 7d4b0a221e8607595994d4c31a5111ba55d01c79891ebbe9604ccaf6ced549e6ff301287003d028e7632d76b115366be086d04f480e975e60e37a9e958d28790
7
- data.tar.gz: 86ad46aae7bfeeacd9333f32ac67e8eef19d240cdcfb7c15cf9be8749787819d74a9e8d56b505152fab177660e3d3f89d465d5e7e7b506c52c800f5fc2358635
6
+ metadata.gz: 71b2bbba19cf139b7ee915860b9749f4c7f9cb031a9f7d076b5ab8f025b49a58ed2ad975d9b209130da0a61899bea6b7cc0ad4f39bbf6e4e67bc48159526ebbe
7
+ data.tar.gz: 2467c785eeed4f7c1acbb72abef7c1df03abd1b87e64ee50e847594589155fd82f9ec3578816ee6b9ec7769f11be88569ac48aa8e34867e0248863eb6e9eecd6
@@ -1,7 +1,7 @@
1
1
  module RsrGroup
2
2
  class Inventory < Base
3
3
 
4
- # This corresponds with the 'rsrinventory-new.txt' and 'rsrinventory-keydlr-new.txt' files
4
+ # This corresponds with the 'rsrinventory-new.txt' and 'rsrinventory-keydlr-new.txt' files
5
5
  # and the +DEFAULT_CATALOG_FILENAME+ and +KEYDEALER_CATALOG_FILENAME+ constants
6
6
  DEFAULT_CATALOG_SMART_OPTS = {
7
7
  chunk_size: 500,
@@ -12,7 +12,7 @@ module RsrGroup
12
12
  user_provided_headers: [
13
13
  :item_identifier, :upc, :short_description, :department_number, :manufacturer_id, :retail_price,
14
14
  :price, :weight, :quantity, :model, :manufacturer, :mfg_number, :allocated_closeout_deleted, :long_description,
15
- :image_name, 51.times.map { |i| "state_#{i}".to_sym }, :ships_ground_only, :signature_required,
15
+ :image_name, 51.times.map { |i| "state_#{i}".to_sym }, :ships_ground_only, :signature_required,
16
16
  :blocked_from_drop_ship, :date_entered, :map_price, :image_disclaimer, :length, :width, :height, :null
17
17
  ].flatten,
18
18
  remove_unmapped_keys: true,
@@ -35,17 +35,19 @@ module RsrGroup
35
35
  @options = options
36
36
  end
37
37
 
38
- def self.quantity(options = {}, &block)
38
+ def self.quantity(options = {})
39
39
  requires!(options, :username, :password)
40
- new(options).quantity &block
40
+ new(options).quantity
41
41
  end
42
42
 
43
- def self.all(options = {}, &block)
43
+ def self.all(options = {})
44
44
  requires!(options, :username, :password)
45
- new(options).all &block
45
+ new(options).all
46
46
  end
47
47
 
48
- def all(&block)
48
+ def all
49
+ items = []
50
+
49
51
  connect(@options) do |ftp|
50
52
  tempfile = Tempfile.new
51
53
 
@@ -69,16 +71,20 @@ module RsrGroup
69
71
  item[:quantity] = item[:quantity].to_i
70
72
  end
71
73
 
72
- yield(item)
74
+ items << item
73
75
  end
74
76
  end
75
77
 
76
78
  tempfile.unlink
77
79
  end
80
+
81
+ items
78
82
  end
79
83
 
80
84
  # Parse through the 'IM-QTY-CSV.csv' file
81
- def quantity(&block)
85
+ def quantity
86
+ items = []
87
+
82
88
  connect(@options) do |ftp|
83
89
  tempfile = Tempfile.new
84
90
 
@@ -97,12 +103,15 @@ module RsrGroup
97
103
  SmarterCSV.process(tempfile, DEFAULT_QUANTITY_SMART_OPTS) do |chunk|
98
104
  chunk.each do |item|
99
105
  item[:quantity] = item[:quantity].to_i
100
- yield(item)
106
+
107
+ items << item
101
108
  end
102
109
  end
103
110
 
104
111
  tempfile.unlink
105
112
  end
113
+
114
+ items
106
115
  end
107
116
 
108
117
  end
@@ -1,3 +1,3 @@
1
1
  module RsrGroup
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
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: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-05 00:00:00.000000000 Z
11
+ date: 2019-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smarter_csv