booking-ruby 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -5
- data/bin/console +5 -4
- data/lib/booking_api/client.rb +5 -0
- data/lib/booking_api/images/image.rb +4 -1
- data/lib/booking_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b026faa04fec771212540e76ab1f7bddc913f61
|
4
|
+
data.tar.gz: f588970398027e88a4f5aee58d081974b0ede88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ae0c855d774f70fef89225cf4d1f70ea6ff9067971e3c017fce14014368a14c340592df21efff7c13ad0cdbd2ea3a94690cde13f7c4bb5e85b1f7296c8df0b
|
7
|
+
data.tar.gz: ab284210786fed3265229cba1a1a025054f68c57f421a7daa98ba812b7517434af8c8e1c4ada7210416706a47fb7399a0d4f7469861cd92db15dadd56565d819
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/hendricius/booking.svg?branch=master)](https://travis-ci.org/hendricius/booking)
|
4
4
|
|
5
|
-
This is a wrapper for the Booking.com API. Currently only
|
5
|
+
This is a wrapper for the Booking.com API. Currently only `gethotelavailbilityV2` and `getHotelDescriptionTranslations` are supported.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install booking-ruby
|
22
22
|
|
23
|
-
|
23
|
+
# Setup
|
24
24
|
|
25
25
|
Initialize the the gem by setting your username and password:
|
26
26
|
|
@@ -29,9 +29,10 @@ Initialize the the gem by setting your username and password:
|
|
29
29
|
BookingApi.password = 'your-password'
|
30
30
|
```
|
31
31
|
|
32
|
-
|
32
|
+
# Supported endpoints
|
33
|
+
## `get_hotel_availabillity`
|
33
34
|
|
34
|
-
```
|
35
|
+
```ruby
|
35
36
|
params = {
|
36
37
|
checkin: Time.now.strftime("%F"),
|
37
38
|
checkout: (Time.now + (60 * 60 * 24 * 7 * 2)).strftime("%F"),
|
@@ -69,5 +70,34 @@ response = BookingApi::Client.new.get_hotel_availabillity(request_parameters: pa
|
|
69
70
|
|
70
71
|
```
|
71
72
|
|
72
|
-
##
|
73
|
+
## `get_hotel_description_translations`
|
74
|
+
```ruby
|
75
|
+
params = { hotel_ids: [10003] }
|
76
|
+
response = BookingApi::Client.new.get_hotel_description_translations(request_parameters: params)
|
77
|
+
|
78
|
+
response.body # =>
|
79
|
+
[
|
80
|
+
{
|
81
|
+
"hotel_id"=>"10003",
|
82
|
+
"descriptiontype_id"=>6,
|
83
|
+
"description"=>
|
84
|
+
"Das Asterisk Hotel bietet 3-Sterne-Unterkünfte in 2 renovierten Gebäuden aus dem 19. Jahrhundert im Zentrum von Amsterdam. Die Unterkunft ist 10 Minuten vom Rijksmuseum entfernt und verfügt über kostenloses WLAN in allen Bereichen.",
|
85
|
+
"languagecode"=>"de"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"languagecode"=>"en",
|
89
|
+
"description"=>
|
90
|
+
"Asterisk Hotel offers 3-star accommodation in 2 restored 19th century buildings in the centre of Amsterdam. It is situated 10 minutes from the Rijksmuseum and offers free WiFi in the entire property.",
|
91
|
+
"hotel_id"=>"10003",
|
92
|
+
"descriptiontype_id"=>6
|
93
|
+
}
|
94
|
+
]
|
95
|
+
```
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
# FAQ
|
73
101
|
To get access to the API you have to signup as an affiliate for booking.com. They will then send you the API documentation with credentials to obtain data.
|
102
|
+
|
103
|
+
Check the official documentation here: https://distribution-xml.booking.com/affiliates/documentation/
|
data/bin/console
CHANGED
@@ -7,8 +7,9 @@ require "booking_api"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
10
|
|
13
|
-
|
14
|
-
|
11
|
+
def reload!
|
12
|
+
Dir.glob("lib/**/*.rb") { |file| load file }
|
13
|
+
end
|
14
|
+
require "pry"
|
15
|
+
Pry.start
|
data/lib/booking_api/client.rb
CHANGED
@@ -25,6 +25,11 @@ module BookingApi
|
|
25
25
|
Images::ResponseList.new(response)
|
26
26
|
end
|
27
27
|
|
28
|
+
def get_hotel_description_translations(request_parameters: {})
|
29
|
+
default_parameters = {}
|
30
|
+
http_service.request_post("/json/bookings.getHotelDescriptionTranslations", default_parameters.merge(request_parameters))
|
31
|
+
end
|
32
|
+
|
28
33
|
private
|
29
34
|
|
30
35
|
end
|
@@ -16,8 +16,11 @@ module BookingApi
|
|
16
16
|
@raw_data[:photo_id].to_i
|
17
17
|
end
|
18
18
|
|
19
|
+
# returns the largest file url for the image
|
20
|
+
#
|
21
|
+
# available sizes include: 840x460 and 1280x900
|
19
22
|
def largest_file_url
|
20
|
-
@raw_data[:url_original].gsub("max500", "
|
23
|
+
@raw_data[:url_original].gsub("max500", "max1280x900")
|
21
24
|
end
|
22
25
|
|
23
26
|
def is_default_image?
|
data/lib/booking_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: booking-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hendrik Kleinwaechter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|