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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72cf31755f44dfcc866e18686ed537ff8c18a007
4
- data.tar.gz: ff2eb37a978de9dbc58e7acc9d500adae7a23ffe
3
+ metadata.gz: 6005b72bd6d6b2c13d6b0943d48e306e2d71a2fa
4
+ data.tar.gz: 124b624d7c728e6541d3b057f8b65d3be88ac5fb
5
5
  SHA512:
6
- metadata.gz: 9e9e470bb51bb3fbb8c89664b4a1a386cd33a5d648f325dd28450d2e773e72b101ad8f1fa91423a074cca0a1bf5b0774f4929b7627c735460bdd9ebfaec554e0
7
- data.tar.gz: df400f306a153603eb0ee3d7787ed9b238637bddb16812e7fbf9c86dbbd6590169cb1380dffe752faa260e2afcfe0b9fcfea73f69474ea7911a41fd56b813942
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.find_all_available_dates
33
+ calendar.find_available_dates
34
34
  calendar.available?(Date.today, Date.tomorrow)
35
35
  #=> true/false
36
36
 
@@ -21,11 +21,23 @@ module VRBO
21
21
  available
22
22
  end
23
23
 
24
- def find_all_available_dates
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
- def calendar_url
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
@@ -1,3 +1,3 @@
1
1
  module VRBO
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -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.find_all_available_dates.length
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.0
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-16 00:00:00.000000000 Z
11
+ date: 2014-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize