lcbo 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -2
- data/CONTRIBUTORS +2 -0
- data/README.md +4 -2
- data/lib/lcbo/pages/inventory_page.rb +8 -34
- data/lib/lcbo/version.rb +1 -1
- metadata +3 -2
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
+
Version 0.9.3
|
2
|
+
|
3
|
+
* 4x speed boost to InventoryPage.parse courtesy of Justin Giancola.
|
4
|
+
|
1
5
|
Version 0.9.2
|
2
6
|
|
3
|
-
* Fixed potential bug in some versions of Ruby where Object#send semantics
|
7
|
+
* Fixed potential bug in some versions of Ruby where Object#send semantics
|
8
|
+
cause a failure when calling private or protected methods.
|
4
9
|
|
5
10
|
Version 0.9.1
|
6
11
|
|
7
12
|
* Removed dependency on Addressable.
|
8
|
-
* Refactored tests to use MiniTest::Spec instead of RSpec, removing another
|
13
|
+
* Refactored tests to use MiniTest::Spec instead of RSpec, removing another
|
14
|
+
dependency.
|
9
15
|
|
10
16
|
Version 0.9.0
|
11
17
|
|
data/CONTRIBUTORS
ADDED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# LCBO: The Ruby Gem
|
2
2
|
|
3
|
-
This library is used to gather data for [LCBO API](http://lcboapi.com). It
|
3
|
+
This library is used to gather data for [LCBO API](http://lcboapi.com). It
|
4
|
+
allows you to request and parse store, product, inventory, and product list
|
5
|
+
pages directly from the [LCBO](http://lcbo.com) website.
|
4
6
|
|
5
7
|
## Synopsis
|
6
8
|
|
@@ -20,7 +22,7 @@ This library is used to gather data for [LCBO API](http://lcboapi.com). It allow
|
|
20
22
|
|
21
23
|
## Installation
|
22
24
|
|
23
|
-
Use
|
25
|
+
Use RubyGems: `gem install lcbo`
|
24
26
|
|
25
27
|
## Notes
|
26
28
|
|
@@ -16,41 +16,15 @@ module LCBO
|
|
16
16
|
|
17
17
|
emits :inventories do
|
18
18
|
# [updated_on, store_no, quantity]
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
h[:store_no] = begin
|
29
|
-
node.
|
30
|
-
to_s.
|
31
|
-
match(/\?STORE=([0-9]{1,3})\&/).
|
32
|
-
captures[0].
|
33
|
-
to_s.
|
34
|
-
to_i
|
35
|
-
end
|
36
|
-
h[:quantity] = begin
|
37
|
-
node.
|
38
|
-
css('td[width="13%"]')[0].
|
39
|
-
content.
|
40
|
-
strip.
|
41
|
-
to_i
|
42
|
-
end
|
43
|
-
ary << h
|
19
|
+
doc.css('table[cellpadding="3"] tr[bgcolor] > td[width="17%"] > a.item-details-col5').zip(
|
20
|
+
doc.css('table[cellpadding="3"] tr[bgcolor] > td > a.item-details-col0'),
|
21
|
+
doc.css('table[cellpadding="3"] tr[bgcolor] > td[width="13%"]')).map do |updated_on, store_no, quantity|
|
22
|
+
{
|
23
|
+
:updated_on => CrawlKit::FastDateHelper[updated_on.text.strip],
|
24
|
+
:store_no => store_no["href"].match(/\?STORE=([0-9]{1,3})\&/)[1].to_i,
|
25
|
+
:quantity => quantity.content.strip.to_i,
|
26
|
+
}
|
44
27
|
end
|
45
28
|
end
|
46
|
-
|
47
|
-
def inventory_table
|
48
|
-
doc.css('table[cellpadding="3"]')
|
49
|
-
end
|
50
|
-
|
51
|
-
def inventory_table_rows
|
52
|
-
inventory_table.css('tr[bgcolor]')
|
53
|
-
end
|
54
|
-
|
55
29
|
end
|
56
30
|
end
|
data/lib/lcbo/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 3
|
9
|
+
version: 0.9.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Carsten Nielsen
|
@@ -55,6 +55,7 @@ extra_rdoc_files: []
|
|
55
55
|
files:
|
56
56
|
- .gitignore
|
57
57
|
- CHANGELOG.md
|
58
|
+
- CONTRIBUTORS
|
58
59
|
- Gemfile
|
59
60
|
- Gemfile.lock
|
60
61
|
- LICENSE
|