vrbo 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vrbo/calendar.rb +4 -5
- data/lib/vrbo/version.rb +1 -1
- data/test/vrbo/calendar_test.rb +8 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e270cf50db857e13ff31144a26c6709004f5b37
|
4
|
+
data.tar.gz: 44946d1a06927d2851b466cd3778f7e496aab390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d98e6ebcf1b27439114ac95d14ddc4f314245e07d148fbb5fe3ae2feb1c3c45eb827ed68b8cc12b3c380b38fae1e3b9d7c52120ba9f1b0a1eb50c3be511bba9
|
7
|
+
data.tar.gz: 24c8e72c6b2fbf8d34e408ec7bcba8aafbf22fef76b0d81cc5adce8177cb065c75b185dd86aed184b205fdd7893550cb0d18bddcfaf5509adf6884ed238344d4
|
data/lib/vrbo/calendar.rb
CHANGED
@@ -26,9 +26,7 @@ module VRBO
|
|
26
26
|
@available_dates = today.upto(today + 365).map { |date| date_if_available(date) }.compact
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
def calendar_url(protocol = 'http')
|
29
|
+
def url(protocol = 'http')
|
32
30
|
if id
|
33
31
|
"#{protocol}://www.vrbo.com/#{id}/calendar"
|
34
32
|
else
|
@@ -36,6 +34,8 @@ module VRBO
|
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
37
|
+
alias :find_all_available_dates :find_available_dates
|
38
|
+
|
39
39
|
private
|
40
40
|
|
41
41
|
def date_if_available(date)
|
@@ -53,7 +53,7 @@ module VRBO
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def calendar
|
56
|
-
@calendar ||= agent.get(
|
56
|
+
@calendar ||= agent.get(url)
|
57
57
|
end
|
58
58
|
|
59
59
|
def agent
|
@@ -64,6 +64,5 @@ module VRBO
|
|
64
64
|
def table_xpath(date)
|
65
65
|
"//b[contains(text(), '#{date.strftime('%B %Y')}')]/following-sibling::table"
|
66
66
|
end
|
67
|
-
|
68
67
|
end
|
69
68
|
end
|
data/lib/vrbo/version.rb
CHANGED
data/test/vrbo/calendar_test.rb
CHANGED
@@ -47,14 +47,15 @@ class CalendarTest < MiniTest::Unit::TestCase
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_passing_calendar_id
|
50
|
-
|
51
|
-
assert_equal calendar_id,
|
52
|
-
assert_equal "http://www.vrbo.com/#{calendar_id}/calendar",
|
50
|
+
calendar = VRBO::Calendar.new(calendar_id)
|
51
|
+
assert_equal calendar_id, calendar.id
|
52
|
+
assert_equal "http://www.vrbo.com/#{calendar_id}/calendar", calendar.url
|
53
|
+
assert_equal "https://www.vrbo.com/#{calendar_id}/calendar", calendar.url('https')
|
53
54
|
end
|
54
55
|
|
55
56
|
def test_no_calendar_id_given
|
56
57
|
assert_raises ArgumentError do
|
57
|
-
VRBO::Calendar.new.
|
58
|
+
VRBO::Calendar.new.url
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
@@ -62,9 +63,9 @@ class CalendarTest < MiniTest::Unit::TestCase
|
|
62
63
|
VRBO.configure do |config|
|
63
64
|
config.calendar_id = calendar_id
|
64
65
|
end
|
65
|
-
|
66
|
+
calendar = VRBO::Calendar.new
|
66
67
|
VRBO.reset_config
|
67
|
-
assert_equal calendar_id,
|
68
|
-
assert_equal "http://www.vrbo.com/#{calendar_id}/calendar",
|
68
|
+
assert_equal calendar_id, calendar.id
|
69
|
+
assert_equal "http://www.vrbo.com/#{calendar_id}/calendar", calendar.url
|
69
70
|
end
|
70
71
|
end
|