lipseys 3.0.1 → 4.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: ef56a0dd5f1678c2988c74e16c1eb6b17f770ee81af235fd7175e503c0e82d59
4
- data.tar.gz: f652f6409e46bcb51f11a73affb0031c94c63f2842e29833e91a9d7d54a070d8
2
+ SHA1:
3
+ metadata.gz: f73cbca0a5026fabdaec1be6e1f42c4f435cd2b2
4
+ data.tar.gz: 242eda1d474849388c705993c6fbe37621184a99
5
5
  SHA512:
6
- metadata.gz: 9b6f1358deebf524df3712a369060234795bc6c109950b463c3cd854baae5efae56d9c346b9bb41954464f48c58303cab522eb557273e8c5bf01276360e51c3a
7
- data.tar.gz: 16d3a7c98e1f3bcffc4660462c673073baf235594fbe6724782823a42c1279731d9dbc2c846078a11ba43692f43d95a991aef100a193fae143e12b7e0a85424f
6
+ metadata.gz: 2d48f5a68bb4f2d048b47da66ec71caa50b9f929af977f1c7080bf1f2771bba7abc457e0edac4d89278b07f71092fb58e1a53175a2b30205168fd1448ce426af
7
+ data.tar.gz: ff4c8c1c24fdb68d928ae43fb13e5846da1c26707371200e6406f232fd76b49c818de9996da8e55c413bbe66f770f3798c7f7733c46186d8192b3d407f107759
@@ -11,15 +11,16 @@ module Lipseys
11
11
  @options = options
12
12
  end
13
13
 
14
- def self.all(options = {}, &block)
14
+ def self.all(options = {})
15
15
  requires!(options, :username, :password)
16
- new(options).all &block
16
+ new(options).all
17
17
  end
18
18
 
19
- def all(&block)
19
+ def all
20
20
  inventory_tempfile = stream_to_tempfile(Lipseys::Inventory::API_URL, @options)
21
21
  catalog_tempfile = stream_to_tempfile(API_URL, @options)
22
- inventory = Array.new
22
+ inventory = []
23
+ items = []
23
24
 
24
25
  # Let's get the inventory and toss 'er into an array
25
26
  Lipseys::Parser.parse(inventory_tempfile, 'Item') do |node|
@@ -32,21 +33,22 @@ module Lipseys
32
33
  end
33
34
 
34
35
  Lipseys::Parser.parse(catalog_tempfile, 'Item') do |node|
35
- hash = map_hash(node)
36
- availability = inventory.select { |i| i[:item_identifier] == hash[:item_identifier] }.first
36
+ item = map_hash(node)
37
+ availability = inventory.select { |i| i[:item_identifier] == item[:item_identifier] }.first
37
38
 
38
39
  if availability
39
- hash[:price] = availability[:price]
40
- hash[:quantity] = availability[:quantity]
41
- hash[:map_price] = availability[:map_price]
40
+ item[:price] = availability[:price]
41
+ item[:quantity] = availability[:quantity]
42
+ item[:map_price] = availability[:map_price]
42
43
  end
43
44
 
44
- yield hash
45
+ items << item
45
46
  end
46
47
 
47
48
  inventory_tempfile.unlink
48
49
  catalog_tempfile.unlink
49
- true
50
+
51
+ items
50
52
  end
51
53
 
52
54
  private
@@ -1,3 +1,3 @@
1
1
  module Lipseys
2
- VERSION = '3.0.1'.freeze
2
+ VERSION = '4.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lipseys
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.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: 2018-08-24 00:00:00.000000000 Z
11
+ date: 2019-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  requirements: []
160
160
  rubyforge_project:
161
- rubygems_version: 2.7.7
161
+ rubygems_version: 2.6.12
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Ruby library for Lipsey's API.