vrbo 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/vrbo/calendar.rb +15 -10
- data/lib/vrbo/version.rb +1 -1
- data/test/vrbo/calendar_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6005b72bd6d6b2c13d6b0943d48e306e2d71a2fa
|
4
|
+
data.tar.gz: 124b624d7c728e6541d3b057f8b65d3be88ac5fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12ed01e0c19f5f7f118ca46c8f5157dbdfcd3cdd11180252573a39b8f277116e5b0228dced973b17abedc34d532e6d4569ca594e023d0686503b5d80e746ec69
|
7
|
+
data.tar.gz: 55e0efc0820f4106ce33a97a7b43818b33a893c5cd8d6878f413437f9500c6f17eee924b9a22bed32f8414a4cdd744dc2ccb0151b51016a0541fa76a9f69a85c
|
data/README.md
CHANGED
@@ -30,7 +30,7 @@ If you're just working with one calendar, then you can specify the VRBO calendar
|
|
30
30
|
Then to lookup available dates and see if a date range is available:
|
31
31
|
|
32
32
|
calendar = VRBO::Calendar.new
|
33
|
-
calendar.
|
33
|
+
calendar.find_available_dates
|
34
34
|
calendar.available?(Date.today, Date.tomorrow)
|
35
35
|
#=> true/false
|
36
36
|
|
data/lib/vrbo/calendar.rb
CHANGED
@@ -21,11 +21,23 @@ module VRBO
|
|
21
21
|
available
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def find_available_dates
|
25
25
|
today = Date.today
|
26
26
|
@available_dates = today.upto(today + 365).map { |date| date_if_available(date) }.compact
|
27
27
|
end
|
28
28
|
|
29
|
+
alias :find_all_available_dates :find_available_dates
|
30
|
+
|
31
|
+
def calendar_url(protocol = 'http')
|
32
|
+
if id
|
33
|
+
"#{protocol}://www.vrbo.com/#{id}/calendar"
|
34
|
+
else
|
35
|
+
raise ArgumentError, 'You must provide a calendar id'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
29
41
|
def date_if_available(date)
|
30
42
|
m = date.month.to_s
|
31
43
|
days[m] ||= collect_days_for_month(date)
|
@@ -48,17 +60,10 @@ module VRBO
|
|
48
60
|
@agent ||= Mechanize.new
|
49
61
|
end
|
50
62
|
|
51
|
-
|
52
|
-
if id
|
53
|
-
"http://www.vrbo.com/#{id}/calendar"
|
54
|
-
else
|
55
|
-
raise ArgumentError, 'You must provide a calendar id'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# March 2014
|
63
|
+
# e.g. March 2014
|
60
64
|
def table_xpath(date)
|
61
65
|
"//b[contains(text(), '#{date.strftime('%B %Y')}')]/following-sibling::table"
|
62
66
|
end
|
67
|
+
|
63
68
|
end
|
64
69
|
end
|
data/lib/vrbo/version.rb
CHANGED
data/test/vrbo/calendar_test.rb
CHANGED
@@ -40,7 +40,7 @@ class CalendarTest < MiniTest::Unit::TestCase
|
|
40
40
|
|
41
41
|
def test_find_all_available_dates
|
42
42
|
# 3 days taken for each month (36) + 1 day padding
|
43
|
-
assert_equal 37, vrbo_calendar.
|
43
|
+
assert_equal 37, vrbo_calendar.find_available_dates.length
|
44
44
|
assert_equal today.to_s, vrbo_calendar.available_dates.first
|
45
45
|
assert_equal (today + 365).to_s, vrbo_calendar.available_dates.last
|
46
46
|
assert_equal vrbo_calendar.days.length, 12
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vrbo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|