lipseys 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/lipseys/catalog.rb +13 -11
- data/lib/lipseys/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f73cbca0a5026fabdaec1be6e1f42c4f435cd2b2
|
4
|
+
data.tar.gz: 242eda1d474849388c705993c6fbe37621184a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d48f5a68bb4f2d048b47da66ec71caa50b9f929af977f1c7080bf1f2771bba7abc457e0edac4d89278b07f71092fb58e1a53175a2b30205168fd1448ce426af
|
7
|
+
data.tar.gz: ff4c8c1c24fdb68d928ae43fb13e5846da1c26707371200e6406f232fd76b49c818de9996da8e55c413bbe66f770f3798c7f7733c46186d8192b3d407f107759
|
data/lib/lipseys/catalog.rb
CHANGED
@@ -11,15 +11,16 @@ module Lipseys
|
|
11
11
|
@options = options
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.all(options = {}
|
14
|
+
def self.all(options = {})
|
15
15
|
requires!(options, :username, :password)
|
16
|
-
new(options).all
|
16
|
+
new(options).all
|
17
17
|
end
|
18
18
|
|
19
|
-
def all
|
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 =
|
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
|
-
|
36
|
-
availability = inventory.select { |i| i[:item_identifier] ==
|
36
|
+
item = map_hash(node)
|
37
|
+
availability = inventory.select { |i| i[:item_identifier] == item[:item_identifier] }.first
|
37
38
|
|
38
39
|
if availability
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
item[:price] = availability[:price]
|
41
|
+
item[:quantity] = availability[:quantity]
|
42
|
+
item[:map_price] = availability[:map_price]
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
+
items << item
|
45
46
|
end
|
46
47
|
|
47
48
|
inventory_tempfile.unlink
|
48
49
|
catalog_tempfile.unlink
|
49
|
-
|
50
|
+
|
51
|
+
items
|
50
52
|
end
|
51
53
|
|
52
54
|
private
|
data/lib/lipseys/version.rb
CHANGED
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:
|
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:
|
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.
|
161
|
+
rubygems_version: 2.6.12
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Ruby library for Lipsey's API.
|