Class: Graticule::Geocoder::Google
- Defined in:
- lib/graticule/geocoder/google.rb
Overview
Defined Under Namespace
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #initialize(key = nil, client_id = nil) ⇒ Google constructor
-
#locate(address) ⇒ Object
Locates
address
returning a Location.
Constructor Details
#initialize(key = nil, client_id = nil) ⇒ Google
17 18 19 20 21 |
# File 'lib/graticule/geocoder/google.rb', line 17 def initialize(key=nil, client_id=nil) @key = key @client_id = client_id @url = URI.parse 'https://maps.googleapis.com/maps/api/geocode/json' end |
Instance Method Details
#locate(address) ⇒ Object
Locates address
returning a Location
24 25 26 |
# File 'lib/graticule/geocoder/google.rb', line 24 def locate(address) get :key => @key, :address => address.is_a?(String) ? address : location_from_params(address).to_s end |