Module: Geoloco::Adapters::Tomtom

Defined in:
lib/geoloco/adapters/tomtom.rb

Overview

Tomtom geocoding adapter

Constant Summary collapse

GEOCODE_URL =
'https://api.tomtom.com/search/2/geocode/%s.json'

Class Method Summary collapse

Class Method Details

.geocode(address, key:, qps_limit: 5) ⇒ Object



10
11
12
13
14
15
# File 'lib/geoloco/adapters/tomtom.rb', line 10

def geocode(address, key:, qps_limit: 5)
  wait_qps_limit_time(qps_limit) unless qps_limit&.zero?
  response = Geoloco.http.get(geocode_url(address), query: { key: key })
  handle_errors(response)
  map_results(response.parsed_response)
end