homeaway-api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +18 -0
- data/LICENSE.txt +209 -0
- data/README.md +127 -0
- data/Rakefile +8 -0
- data/bin/hacurl +176 -0
- data/lib/homeaway/api/adapters/faraday.rb +67 -0
- data/lib/homeaway/api/adapters/hurley.rb +83 -0
- data/lib/homeaway/api/client.rb +224 -0
- data/lib/homeaway/api/domain/add_message.rb +45 -0
- data/lib/homeaway/api/domain/client_includes.rb +44 -0
- data/lib/homeaway/api/domain/conversation.rb +39 -0
- data/lib/homeaway/api/domain/listing.rb +39 -0
- data/lib/homeaway/api/domain/listing_reviews.rb +43 -0
- data/lib/homeaway/api/domain/me.rb +35 -0
- data/lib/homeaway/api/domain/my_inbox.rb +58 -0
- data/lib/homeaway/api/domain/my_listings.rb +48 -0
- data/lib/homeaway/api/domain/my_reservations.rb +53 -0
- data/lib/homeaway/api/domain/quote.rb +53 -0
- data/lib/homeaway/api/domain/search.rb +74 -0
- data/lib/homeaway/api/domain/submit_review.rb +57 -0
- data/lib/homeaway/api/errors/ha_api_errors.rb +144 -0
- data/lib/homeaway/api/paginator.rb +140 -0
- data/lib/homeaway/api/response.rb +49 -0
- data/lib/homeaway/api/util/defaults.rb +92 -0
- data/lib/homeaway/api/util/oauth.rb +81 -0
- data/lib/homeaway/api/util/validators.rb +118 -0
- data/lib/homeaway/api/version.rb +20 -0
- data/lib/homeaway_api.rb +43 -0
- metadata +367 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module Conversation
|
20
|
+
|
21
|
+
# Load Conversation content, including Messages, for a selected Conversation
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/conversation
|
24
|
+
#
|
25
|
+
# @note user must be logged in via 3 legged oauth to call this function without error
|
26
|
+
#
|
27
|
+
# Headers:
|
28
|
+
# * X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
29
|
+
#
|
30
|
+
# @param id [String] The Conversation UUID to load.
|
31
|
+
# @return [HomeAway::API::Response] the result of the call to the API
|
32
|
+
def conversation(id)
|
33
|
+
params = {'id' => HomeAway::API::Util::Validators.uuid(id)}
|
34
|
+
get '/public/conversation', HomeAway::API::Util::Validators.query_keys(params)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module Listing
|
20
|
+
|
21
|
+
# Given a listing id, return details about the listing.
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/listing
|
24
|
+
#
|
25
|
+
# Headers:
|
26
|
+
# * X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
27
|
+
#
|
28
|
+
# @param id [String] The id of the listing.
|
29
|
+
# @option opts [String] :q Use the q parameter to fetch specific listing details.Valid options are AVAILABILITY, DETAILS, LOCATIONS, PHOTOS, RATES, REVIEWS If no value is given, the listing is returned with minimal content., can be an array of multiple values
|
30
|
+
# @return [HomeAway::API::Response] the result of the call to the API
|
31
|
+
def listing(id, q=nil)
|
32
|
+
params = {'id' => id.to_s}
|
33
|
+
params['q'] = HomeAway::API::Util::Validators.array(q) unless q == nil
|
34
|
+
get '/public/listing', HomeAway::API::Util::Validators.query_keys(params)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module ListingReviews
|
20
|
+
|
21
|
+
# Returns a page of reviews for the specified listing and unit
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/listingReviews
|
24
|
+
#
|
25
|
+
# @param listing_id [String] The listing id to be booked as retrieved from the search operation
|
26
|
+
# @param unit_id [Integer] The id of the unit being booked for the stay
|
27
|
+
# @option opts [Integer] :page The page number to fetch
|
28
|
+
# @option opts [Integer] :page_size The number of reviews to return per page
|
29
|
+
# @return [HomeAway::API::Paginator] the result of the call to the API
|
30
|
+
def listing_reviews(listing_id, unit_id, opts={})
|
31
|
+
params = {
|
32
|
+
'listingId' => listing_id.to_s,
|
33
|
+
'unitId' => unit_id.to_s,
|
34
|
+
'page' => 1,
|
35
|
+
'pageSize' => @configuration.page_size
|
36
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(opts))
|
37
|
+
hashie = get '/public/listingReviews', params
|
38
|
+
HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module Me
|
20
|
+
|
21
|
+
# Returns information about the logged in user.
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/me
|
24
|
+
#
|
25
|
+
# @note user must be logged in via 3 legged oauth to call this function without error
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# @return [HomeAway::API::Response] the result of the call to the API
|
29
|
+
def me
|
30
|
+
get '/public/me', {}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module MyInbox
|
20
|
+
|
21
|
+
# Load the Owner's Inbox for the logged-in User
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/myInbox
|
24
|
+
#
|
25
|
+
# @note user must be logged in via 3 legged oauth to call this function without error
|
26
|
+
#
|
27
|
+
# Headers:
|
28
|
+
# * X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
29
|
+
#
|
30
|
+
# @option opts [String] :status The conversation status by which to filter the inbox. The supported values for this param are: BLOCKED_RESERVATION, BOOKING, CANCELLED, INQUIRY, PAYMENT_REQUEST_SENT, POST_STAY, QUOTE_SENT, REPLIED, RESERVATION, RESERVATION_DOWNLOADABLE, RESERVATION_REQUEST, RESERVATION_REQUEST_DECLINED, RESERVATION_REQUEST_EXPIRED, STAYING, TENTATIVE_RESERVATION, UNKNOWN, RECALCULATE
|
31
|
+
# @option opts [Boolean] :unreplied_only A flag indicating that the inbox should be populated by only unreplied conversations
|
32
|
+
# @option opts [String] :sort The field by which to Sort Conversations.
|
33
|
+
# @option opts [DateTime or Date parsible string] :before_date Conversations will not be included in the results unless they had some activity on or before this date. Use yyyy-MM-dd as the format
|
34
|
+
# @option opts [Boolean] :archived A flag indicating that the inbox should be populated by only archived conversations
|
35
|
+
# @option opts [String] :search A string to search for.
|
36
|
+
# @option opts [Boolean] :inquiries A flag indicating the inbox should be populated by only inquiries
|
37
|
+
# @option opts [Boolean] :sort_reservation_requests_inline If True, in the default Inbox view, sort Reservation Requests inline rather than at the top.
|
38
|
+
# @option opts [Boolean] :reservations A flag indicating the inbox should be populated by only reservations
|
39
|
+
# @option opts [String] :sort_order The order to sort by, ASC or DESC.
|
40
|
+
# @option opts [Boolean] :unread_only A flag indicating that the inbox should be populated by only unread conversations
|
41
|
+
# @option opts [DateTime or Date parsible string] :after_date Conversations will not be included in the results unless they had some activity on or after this date. Use yyyy-MM-dd as the format
|
42
|
+
# @option opts [Integer] :page The page of the result set
|
43
|
+
# @option opts [Integer] :page_size The size of a page of results
|
44
|
+
# @option opts [Boolean] :as_traveler set this to true if you are attempting to get a traveler's inbox, defaults to false which will retrieve an owner's inbox
|
45
|
+
# @return [HomeAway::API::Paginator] the result of the call to the API
|
46
|
+
def my_inbox(opts={})
|
47
|
+
params = {
|
48
|
+
'page' => 1,
|
49
|
+
'pageSize' => @configuration.page_size,
|
50
|
+
'asTraveler' => false
|
51
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(opts))
|
52
|
+
hashie = get '/public/myInbox', params
|
53
|
+
HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module MyListings
|
20
|
+
|
21
|
+
# Returns a paginated summary of the owner's listings.
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/myListings
|
24
|
+
#
|
25
|
+
# @note user must be logged in via 3 legged oauth to call this function without error
|
26
|
+
#
|
27
|
+
# Headers:
|
28
|
+
# * X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
29
|
+
#
|
30
|
+
# @option opts [String] :filter_product_type Filter result by the subscription type of the listing: sub|ppb
|
31
|
+
# @option opts [String] :filter_status Filter result by the enabled status of the listing: ENABLED|DISABLED
|
32
|
+
# @option opts [String] :address_contains Filter results by a word contained in the address
|
33
|
+
# @option opts [String] :sort_by Sort (format [field:ASC|DESC,field:ASC|DESC,...]) result by one or more of the following: status|updated|firstLive|subscriptionEnd|subscriptionStart|tierCode|productType
|
34
|
+
# @option opts [Integer] :page The page of the listing set.
|
35
|
+
# @option opts [Integer] :page_size The size of the page to return
|
36
|
+
# @return [HomeAway::API::Paginator] the result of the call to the API
|
37
|
+
def my_listings(opts={})
|
38
|
+
params = {
|
39
|
+
'page' => 1,
|
40
|
+
'pageSize' => @configuration.page_size
|
41
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(opts))
|
42
|
+
hashie = get '/public/myListings', params
|
43
|
+
HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module MyReservations
|
20
|
+
|
21
|
+
# Returns a paginated list of the current and future reservations for the given listing from oldest to newest.
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/myReservations
|
24
|
+
#
|
25
|
+
# @note user must be logged in via 3 legged oauth to call this function without error
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# @param listing_id [String] The listingId of the listing to get the reservations for.
|
29
|
+
# @option opts [String] :degin_date Lower bound date of the reservations to find in the format yyyy-MM-dd
|
30
|
+
# @option opts [String] :reference_number Reference number to filter on
|
31
|
+
# @option opts [String] :end_date Upper bound date of the reservations to find in the format yyyy-MM-dd
|
32
|
+
# @option opts [String] :last_name Last name of traveler to filter on
|
33
|
+
# @option opts [String] :payment_status PaymentStatus to filter on
|
34
|
+
# @option opts [String] :availability_status Status to filter on
|
35
|
+
# @option opts [String] :first_name First name of traveler to filter on
|
36
|
+
# @option opts [String] :email Email of traveler to filter on
|
37
|
+
# @option opts [String] :sort_by Sort (format [field:ASC|DESC,field:ASC|DESC,...]) result by one or more of the following: availabilityStatus|beginDate|paymentStatus
|
38
|
+
# @option opts [Integer] :page The page of the listing set.
|
39
|
+
# @option opts [Integer] :page_size The size of the page to return
|
40
|
+
# @return [HomeAway::API::Paginator] the result of the call to the API
|
41
|
+
def my_reservations(listing_id, opts={})
|
42
|
+
params = {
|
43
|
+
'page' => 1,
|
44
|
+
'pageSize' => @configuration.page_size,
|
45
|
+
'listingId' => listing_id.to_s
|
46
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(opts))
|
47
|
+
hashie = get '/public/myReservations', params
|
48
|
+
HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module Quote
|
20
|
+
|
21
|
+
# Generates an up to date quote and booking url
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/bookStay
|
24
|
+
#
|
25
|
+
# Headers:
|
26
|
+
# * X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
27
|
+
#
|
28
|
+
# @param listing_id [String] The listing id to be booked as retrieved from the search operation
|
29
|
+
# @param unit_id [String] The id of the unit being booked for the stay
|
30
|
+
# @param adults_count [Integer] The number of adults being booked for the stay
|
31
|
+
# @param departure_date [String] The departure date in the form yyyy-MM-dd
|
32
|
+
# @param arrival_date [String] The arrival date in the form yyyy-MM-dd
|
33
|
+
# @option opts [String] :currency_code The currency to generate the quote in (optional defaults to USD)
|
34
|
+
# @option opts [Boolean] :pet_included Optional boolean indicating that a pet will accompany the guests
|
35
|
+
# @option opts [Integer] :children_count The optional number of children being booked for the stay
|
36
|
+
# @return [HomeAway::API::Response] the result of the call to the API
|
37
|
+
def quote(listing_id, unit_id, adults_count, arrival_date, departure_date, opts={})
|
38
|
+
params = {
|
39
|
+
'listingId' => listing_id.to_s,
|
40
|
+
'unitId' => unit_id.to_s,
|
41
|
+
'departureDate' => HomeAway::API::Util::Validators.date(departure_date),
|
42
|
+
'adultsCount' => HomeAway::API::Util::Validators.integer(adults_count),
|
43
|
+
'arrivalDate' => HomeAway::API::Util::Validators.date(arrival_date),
|
44
|
+
'locale' => 'en'
|
45
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(opts))
|
46
|
+
get '/public/quote', params
|
47
|
+
end
|
48
|
+
|
49
|
+
alias_method :book_stay, :quote
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# Copyright (c) 2015 HomeAway.com, Inc.
|
2
|
+
# All rights reserved. http://www.homeaway.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
module HomeAway
|
17
|
+
module API
|
18
|
+
module Domain
|
19
|
+
module Search
|
20
|
+
|
21
|
+
# Search for listings
|
22
|
+
#
|
23
|
+
# analogous to calling a GET on API url /public/search
|
24
|
+
#
|
25
|
+
# Headers:
|
26
|
+
# * Authenticated: _required_: By specifying a Client object in the method signature, all incoming requests MUST have a valid current OAuth authenticated client
|
27
|
+
# * X-HomeAway-DisplayLocale: _required_: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.
|
28
|
+
#
|
29
|
+
# @option opts [String] :q The query to search for listings with, for example 'austin sleeps 6'
|
30
|
+
# @option opts [Integer] :min_bedrooms Minimum number of bedrooms to search (optional)
|
31
|
+
# @option opts [Integer] :min_sleeps Minimum number of sleeps to search (optional)
|
32
|
+
# @option opts [String] :availability_start Date formatted as yyyy-MM-dd to indicate the earliest available date (lower bound) in the search (optional)
|
33
|
+
# @option opts [Integer] :max_sleeps Maximum number of sleeps to search (optional)
|
34
|
+
# @option opts [String] :availability_end Date formatted as yyyy-MM-dd to indicate the latest available date (upper bound) in the search (optional)
|
35
|
+
# @option opts [Integer] :min_bathrooms Minimum number of bathrooms to search (optional)
|
36
|
+
# @option opts [Float] :center_point_latitude Uses a proximity search to limit results to listings located within a max distance from a specific location, must be sent with centerPointLongitude and distanceInKm
|
37
|
+
# @option opts [String] :refine Refine the search with the given comma delimited refinements (optional comes from a search refinement)
|
38
|
+
# @option opts [String] :sort Sort the results <field:asc|desc> where field is one of (availabilityUpdated, bathrooms, bedrooms, prices, travelerReviewCount, averageRating) (optional)
|
39
|
+
# @option opts [Float] :upper_right_longitude Adds a geographical bounding box constraint to the search. Only listings located within this bounding box will be returned in the results, must be sent with lowerLeftLongitude, upperRightLatitude and upperRightLongitude
|
40
|
+
# @option opts [Float] :distance_in_km Uses a proximity search to limit results to listings located within a max distance from a specific location, must be sent with centerPointLatitude and centerPointLongitude
|
41
|
+
# @option opts [Float] :upper_right_latitude Adds a geographical bounding box constraint to the search. Only listings located within this bounding box will be returned in the results, must be sent with lowerLeftLongitude, upperRightLatitude and upperRightLongitude
|
42
|
+
# @option opts [Integer] :max_bedrooms Maximum number of bedrooms to search (optional)
|
43
|
+
# @option opts [Integer] :max_bathrooms Maximum number of bathrooms to search (optional)
|
44
|
+
# @option opts [Float] :center_point_longitude Uses a proximity search to limit results to listings located within a max distance from a specific location, must be sent with centerPointLatitude and distanceInKm
|
45
|
+
# @option opts [Float] :min_price Minimum price to search (optional)
|
46
|
+
# @option opts [Float] :lower_left_latitude Adds a geographical bounding box constraint to the search. Only listings located within this bounding box will be returned in the results, must be sent with lowerLeftLongitude, upperRightLatitude and upperRightLongitude
|
47
|
+
# @option opts [Float] :lower_left_longitude Adds a geographical bounding box constraint to the search. Only listings located within this bounding box will be returned in the results, must be sent with lowerLeftLongitude, upperRightLatitude and upperRightLongitude
|
48
|
+
# @option opts [Float] :max_price Maximum price to search (optional)
|
49
|
+
# @option opts [String] :image_size Size of the image to return the URL for (optional) must be one of: SMALL, MEDIUM, LARGE
|
50
|
+
# @option opts [Integer] :page The page of the result set
|
51
|
+
# @option opts [Integer] :page_size The size of a page of results
|
52
|
+
# @return [HomeAway::API::Paginator] the result of the call to the API
|
53
|
+
def search(opts={})
|
54
|
+
encoded_opts = opts.merge(opts) do |_, v|
|
55
|
+
if v.is_a? ::String
|
56
|
+
HomeAway::API::Util::Validators.uri_encoded(v)
|
57
|
+
else
|
58
|
+
v
|
59
|
+
end
|
60
|
+
end
|
61
|
+
params = {
|
62
|
+
'locale' => 'en',
|
63
|
+
'page' => 1,
|
64
|
+
'pageSize' => @configuration.page_size
|
65
|
+
}.merge(HomeAway::API::Util::Validators.query_keys(encoded_opts))
|
66
|
+
params['availabilityStart'] = HomeAway::API::Util::Validators.date(params['availabilityStart']) if params.has_key?('availabilityStart')
|
67
|
+
params['availabilityEnd'] = HomeAway::API::Util::Validators.date(params['availabilityEnd']) if params.has_key?('availabilityEnd')
|
68
|
+
hashie = get '/public/search', params
|
69
|
+
HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|