Module: Geoloco::Adapters::Google

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

Overview

Google geocoding adapter

Constant Summary collapse

API_HOST =
'https://maps.googleapis.com'
GEOCODE_PATH =
'/maps/api/geocode/json'

Class Method Summary collapse

Class Method Details

.geocode(address, client_id:, key:) ⇒ Object



14
15
16
17
18
# File 'lib/geoloco/adapters/google.rb', line 14

def geocode(address, client_id:, key:)
  response = Geoloco.http.get(geocode_url(address, client_id, key))
  handle_errors(response, response.parsed_response)
  map_results(response.parsed_response)
end