The hotel_beds
gem interfaces with the HotelBeds.com SOAP API to search for and book hotel rooms.
I'm sure you know how to install Ruby gems by now...
In your Gemfile, before a bundle install
, add:
gem "hotel_beds", "~> X.X.X"
Note: you'll need to replace X.X.X
in the example above with the latest gem version visible in the badge above.
Manually, via command line:
gem install hotel_beds
It's best to check the feature specs to see up-to-date examples, but a basic search example is below:
# create the connection to HotelBeds
client = HotelBeds::Client.new(endpoint: :test, username: "user", password: "pass")
# perform the search
search = client.perform_hotel_search({
check_in_date: Date.today,
check_out_date: Date.today + 1,
rooms: [{ adult_count: 2 }],
destination_code: "SYD"
})
# inspect the response
puts search.response.hotels
# => [<HotelBeds::Model::Hotel>, <HotelBeds::Model::Hotel>]
puts search.response.total_pages
# => 10
puts search.response.current_page
# => 1
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request