davidsons 3.0.0 → 5.0.2

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
  SHA256:
3
- metadata.gz: 6c095654c336bd6826a23769cd96e88e41bff0d88ba671f787c46d76ee9fdc63
4
- data.tar.gz: 1ca343621c484c84ff3c09372957f7a2e99136fdf437d4520e7797da553f09ff
3
+ metadata.gz: 5c156c07e3d5c3e39bdfafae7514e52e263d90e201025f5bd4220c4177ae221b
4
+ data.tar.gz: 855767e6d575a8108e66d6bf944011339d9a74ea4214b35cec350ae5b04bbdcd
5
5
  SHA512:
6
- metadata.gz: dfb5108c31d257f2562ebf464c2baf4a1ad9b62e3ccef095753801a908f76b4bf44963d08fae435fa56f1abe04c39cb5d3a5a1dfd16bc560b0f07e82a0752fcf
7
- data.tar.gz: 4bcedfa9fadb15d4a24c01760489ffa2130de443a868c2c400334f20b96a17f6a5e38dd2d8c0d3668045705361ab9bcf2c2024cebaec18a5c8c9c6c3fea96927
6
+ metadata.gz: 9ae5c4b358f682d0f20f7c109da84a3bb4831a63bfa35f30e3fc527d497c0028bc236359cf5fe839eaf0acb0133555ef7fb43050f7157c61f10ed2abbe424abf
7
+ data.tar.gz: 6593c9ee7858553852b7c4f0b967dc38098627ef2790aa598dc1088f6ab5c78059cc55d11869f6d58d6dc4f3f4d325a2caaeecc5e12b39fcaf5f9a06d7bc2bd9
data/davidsons.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_runtime_dependency "smarter_csv", "~> 1.1.4"
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.14"
28
+ spec.add_development_dependency "bundler", "~> 1.15"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
  spec.add_development_dependency "activesupport", "~> 5"
@@ -28,18 +28,19 @@ module Davidsons
28
28
  @options[:pricing_tier] ||= :regular
29
29
  end
30
30
 
31
- def self.all(options = {}, &block)
31
+ def self.all(options = {})
32
32
  requires!(options, :username, :password)
33
- new(options).all(&block)
33
+ new(options).all
34
34
  end
35
35
 
36
- def all(&block)
36
+ def all
37
37
  tempfile = get_file(WHOLE_CATALOG_FILENAME)
38
+ items = []
38
39
 
39
40
  SmarterCSV.process(tempfile, DEFAULT_SMART_OPTS) do |chunk|
40
41
  chunk.each do |item|
41
- item[:msrp].tr!('$', '')
42
- item[:upc].tr!('#', '')
42
+ item[:msrp]&.tr!('$', '')
43
+ item[:upc]&.tr!('#', '')
43
44
 
44
45
  item[:price] = lowest_price(item)
45
46
  item[:mfg_number] = item[:item_identifier]
@@ -49,11 +50,13 @@ module Davidsons
49
50
  item.delete(:sale_ends)
50
51
  item.delete(:sale_price)
51
52
 
52
- yield(item)
53
+ items << item
53
54
  end
54
55
  end
55
56
 
56
57
  tempfile.unlink
58
+
59
+ items
57
60
  end
58
61
 
59
62
  protected
@@ -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,27 +60,31 @@ 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|
72
73
  chunk.each do |item|
73
- item[:upc].tr!('#', '')
74
+ item[:upc]&.tr!('#', '')
74
75
 
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 = '3.0.0'.freeze
2
+ VERSION = '5.0.2'.freeze
3
3
  end
data/lib/davidsons.rb CHANGED
@@ -36,7 +36,7 @@ module Davidsons
36
36
  def initialize
37
37
  @debug_mode ||= false
38
38
  @ftp_host ||= "ftp.davidsonsinventory.com"
39
- @proxy_url ||= "http://172.31.69.148:8888"
39
+ @proxy_url ||= "http://127.0.0.1:8888"
40
40
  @xmlns ||= "https://dealernetwork.davidsonsinc.com/"
41
41
  end
42
42
  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: 3.0.0
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Knight
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-27 00:00:00.000000000 Z
11
+ date: 2022-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.14'
47
+ version: '1.15'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.14'
54
+ version: '1.15'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +125,7 @@ homepage: ''
125
125
  licenses:
126
126
  - MIT
127
127
  metadata: {}
128
- post_install_message:
128
+ post_install_message:
129
129
  rdoc_options: []
130
130
  require_paths:
131
131
  - lib
@@ -140,9 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.7.7
145
- signing_key:
143
+ rubygems_version: 3.0.8
144
+ signing_key:
146
145
  specification_version: 4
147
146
  summary: Ruby library for Davidson's
148
147
  test_files: []