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 CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('hostelify', '0.4.5') do |p|
5
+ Echoe.new('hostelify', '0.4.6') do |p|
6
6
  p.description = "Simple Hostel Webscrapper."
7
7
  p.url = "http://github.com/holden/hostelify"
8
8
  p.author = "Holden Thomas"
data/hostelify.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{hostelify}
5
- s.version = "0.4.5"
5
+ s.version = "0.4.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Holden Thomas"]
@@ -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
- people = row.at("td.people/select")
100
- people = people.at("option:last-child").inner_text unless people.nil?
101
- price = row.at("td.price")
102
- price = price.inner_text.to_s.match(/[\d.]{1,5}/)[0] unless price.nil?
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 5
9
- version: 0.4.5
8
+ - 6
9
+ version: 0.4.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Holden Thomas