davidsons 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: 8b6d8e48929215b976e928694e4c70c297f7458c
4
- data.tar.gz: a85875486af1ddd78c0c12c79c9666594c0b5736
3
+ metadata.gz: 19e23304e1aaa80a1a477972bab1113d2cb9c442
4
+ data.tar.gz: ded35d0426e562130b3d23396256a673e5ea94bf
5
5
  SHA512:
6
- metadata.gz: 6ab7c69f4cefcfd2243db22788375bd72360021d82c66ccd58070b883aa810c8d939bbec0b06eeae312c713b3e963eb079d2a31829dfae8e72285b10d31fe5bc
7
- data.tar.gz: 24a844813c8ecb1c8c62777c86942a806b1d6f6a80815e41632417bb097f8ffe1acf4a19a4785363af021ad2cac038116a8930f9d7828edec46e35a82c093235
6
+ metadata.gz: f4435834e31c4bf5c0174e62d896c4cb747a93acfca1d18f7085481775c604fffcd43c119d5443651911391f7e2ee1b56560a830577ad1a5e070742bafdc4071
7
+ data.tar.gz: a011ec589fc7f04ebbe8aa24e4bc528ebd6e797844a37fed2d947f0f0ac83b687bbc8177c5759b6de7af0fbf817e1317c68d32f9ba668f0381fb266c2e1d2a04
@@ -50,9 +50,9 @@ module Davidsons
50
50
  # @option options [Symbol] :pricing_tier *optional*
51
51
  # * Denotes which price to use
52
52
  # * Can be :regular or :minimum
53
- def self.all(options = {}, &block)
53
+ def self.all(options = {})
54
54
  requires!(options, :username, :password)
55
- new(options).all(&block)
55
+ new(options).all
56
56
  end
57
57
 
58
58
  # Iterates over all items in the 'davidsons_quantity.csv' file yielding the item_identifier, upc, quantity and locations.
@@ -60,12 +60,13 @@ module Davidsons
60
60
  # @param [Hash] options
61
61
  # @option options [Symbol] :username *required*
62
62
  # @option options [Symbol] :password *required*
63
- def self.quantity(options = {}, &block)
63
+ def self.quantity(options = {})
64
64
  requires!(options, :username, :password)
65
- new(options).quantity(&block)
65
+ new(options).quantity
66
66
  end
67
67
 
68
68
  def all
69
+ items = []
69
70
  tempfile = get_file(WHOLE_CATALOG_FILENAME)
70
71
 
71
72
  SmarterCSV.process(tempfile, DEFAULT_WHOLE_CATALOG_SMART_OPTS) do |chunk|
@@ -75,12 +76,15 @@ module Davidsons
75
76
  item[:price] = lowest_price(item)
76
77
  item[:quantity] = item[:quantity].to_i
77
78
 
78
- yield(item)
79
+ items << item
79
80
  end
80
81
  end
82
+
83
+ items
81
84
  end
82
85
 
83
- def quantity(&block)
86
+ def quantity
87
+ items = []
84
88
  tempfile = get_file(QUANTITY_FILENAME)
85
89
 
86
90
  SmarterCSV.process(tempfile, DEFAULT_QUANTITY_SMART_OPTS) do |chunk|
@@ -88,9 +92,11 @@ module Davidsons
88
92
  item[:quantity] = item[:quantity_nc].to_i + item[:quantity_az].to_i
89
93
  item[:locations] = map_location_quantities(item)
90
94
 
91
- yield(item)
95
+ items << item
92
96
  end
93
97
  end
98
+
99
+ items
94
100
  end
95
101
 
96
102
  private
@@ -1,3 +1,3 @@
1
1
  module Davidsons
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: davidsons
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
  - David Knight
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: savon