Module: Geoloco
- Defined in:
- lib/geoloco.rb,
lib/geoloco/version.rb,
lib/geoloco/geometry.rb,
lib/geoloco/location.rb,
lib/geoloco/adapters/fake.rb,
lib/geoloco/adapters/google.rb,
lib/geoloco/adapters/tomtom.rb
Overview
Geoloco is a multi-adpater geolocation gem, with error handling and test stubs
Defined Under Namespace
Modules: Adapters Classes: Error, Forbidden, Geometry, Location, UnknownAdapter
Constant Summary collapse
- VERSION =
'1.0.0'
Class Attribute Summary collapse
Class Method Summary collapse
-
.geocode(query, adapter: default_adapter, **options) ⇒ Object
Geocodes a given query using the given adapter and options.
Class Attribute Details
.config ⇒ Object
36 37 38 |
# File 'lib/geoloco.rb', line 36 def config @config || {} end |
.default_adapter ⇒ Object
32 33 34 |
# File 'lib/geoloco.rb', line 32 def default_adapter @default_adapter || :google end |
.http ⇒ Object
40 41 42 |
# File 'lib/geoloco.rb', line 40 def http @http || HTTParty end |
Class Method Details
.geocode(query, adapter: default_adapter, **options) ⇒ Object
Geocodes a given query using the given adapter and options
52 53 54 55 |
# File 'lib/geoloco.rb', line 52 def geocode(query, adapter: default_adapter, **) adapter_config = config.fetch(adapter, {}).merge() geocoder(adapter).geocode(query, **adapter_config) end |