Module: HomeAway::API::Domain::Search
- Included in:
- Client
- Defined in:
- lib/homeaway/api/domain/search.rb
Instance Method Summary collapse
-
#search(opts = {}) ⇒ HomeAway::API::Paginator
Search for listings.
Instance Method Details
#search(opts = {}) ⇒ HomeAway::API::Paginator
Search for listings
analogous to calling a GET on API url /public/search
Headers:
-
Authenticated: required: By specifying a Client object in the method signature, all incoming requests MUST have a valid current OAuth authenticated client
-
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.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/homeaway/api/domain/search.rb', line 53 def search(opts={}) encoded_opts = opts.merge(opts) do |_, v| if v.is_a? ::String HomeAway::API::Util::Validators.uri_encoded(v) else v end end params = { 'locale' => 'en', 'page' => 1, 'pageSize' => @configuration.page_size }.merge(HomeAway::API::Util::Validators.query_keys(encoded_opts)) params['availabilityStart'] = HomeAway::API::Util::Validators.date(params['availabilityStart']) if params.has_key?('availabilityStart') params['availabilityEnd'] = HomeAway::API::Util::Validators.date(params['availabilityEnd']) if params.has_key?('availabilityEnd') hashie = get '/public/search', params HomeAway::API::Paginator.new(self, hashie, @configuration.auto_pagination) end |