hostelify 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/hostelify.gemspec +1 -1
- data/lib/hostelify/hostelbookers.rb +5 -7
- metadata +2 -2
data/Rakefile
CHANGED
data/hostelify.gemspec
CHANGED
@@ -39,14 +39,13 @@ class Hostelbookers
|
|
39
39
|
def self.find_hostel_by_id(options)
|
40
40
|
options = @default_options.merge(options)
|
41
41
|
date = Date.strptime(options[:date])
|
42
|
-
id = options[:id]
|
43
42
|
hostel = Hostelify.new
|
44
43
|
|
45
44
|
url = HB_SINGULAR_URL + "&intnights=#{options[:no_days]}&intpeople=1&dtearrival=#{date.strftime('%d/%m/%Y')}&intpropertyid=#{options[:id]}"
|
46
45
|
|
47
46
|
data = Hpricot(open(url))
|
48
47
|
|
49
|
-
hostel.hostel_id = id
|
48
|
+
hostel.hostel_id = options[:id]
|
50
49
|
hostel.name = data.at("h1").inner_text
|
51
50
|
hostel.address = data.at("p.address").inner_text
|
52
51
|
hostel.description = data.at('div[@id="overviewPane"]').inner_text
|
@@ -96,12 +95,11 @@ class Hostelbookers
|
|
96
95
|
if available
|
97
96
|
(available/"tr").each do |row|
|
98
97
|
name = row.at("td.roomType/label/text()")
|
99
|
-
|
100
|
-
people =
|
101
|
-
|
102
|
-
price =
|
98
|
+
people1 = row.at("td.people/select")
|
99
|
+
people = people1.at("option:last-child").inner_text unless people.nil?
|
100
|
+
price1 = row.at("td.price")
|
101
|
+
price = price1.inner_text.to_s.match(/[\d.]{1,5}/)[0] unless price.nil?
|
103
102
|
(0..(options[:no_days].to_i-1)).each do |x|
|
104
|
-
#@availables << { :name => name, :spots => people, :price => price, :bookdate => (date+x).to_s } unless price.nil?
|
105
103
|
@availables << HostelifyAvailable.new(name,price,people,(date+x).to_s) unless price.nil?
|
106
104
|
end
|
107
105
|
end
|