Class: Koine::GoogleMapsClient
- Inherits:
-
Object
- Object
- Koine::GoogleMapsClient
- Defined in:
- lib/koine/google_maps_client.rb,
lib/koine/google_maps_client/version.rb
Constant Summary collapse
- BASE_URL =
'https://maps.googleapis.com/maps/api'
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #geocode(address:) ⇒ Object
- #get(uri, params = {}) ⇒ Object
-
#initialize(api_key: nil, http_client: RestClient) ⇒ GoogleMapsClient
constructor
A new instance of GoogleMapsClient.
Constructor Details
#initialize(api_key: nil, http_client: RestClient) ⇒ GoogleMapsClient
Returns a new instance of GoogleMapsClient.
9 10 11 12 |
# File 'lib/koine/google_maps_client.rb', line 9 def initialize(api_key: nil, http_client: RestClient) @http_client = http_client @api_key = api_key end |
Instance Method Details
#geocode(address:) ⇒ Object
14 15 16 |
# File 'lib/koine/google_maps_client.rb', line 14 def geocode(address:) get('/geocode/json', address: address) end |
#get(uri, params = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/koine/google_maps_client.rb', line 18 def get(uri, params = {}) to_hash do http_client.get(url_for(uri), params: params.merge(key: api_key)) end end |