Class: Geocoder::Lookup::AmazonLocationService

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/lookups/amazon_location_service.rb

Instance Method Summary collapse

Methods inherited from Base

#cache, #handle, #initialize, #map_link_url, #name, #query_url, #required_api_key_parts, #search, #supported_protocols

Constructor Details

This class inherits a constructor from Geocoder::Lookup::Base

Instance Method Details

#results(query) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/geocoder/lookups/amazon_location_service.rb', line 6

def results(query)
  params = { **global_index_name, **query.options }
  if query.reverse_geocode?
    resp = client.search_place_index_for_position(**{ **params, position: query.coordinates.reverse })
  else
    resp = client.search_place_index_for_text(**{ **params, text: query.text })
  end
  resp.results.map(&:place)
end