Class: GeoKit::Geocoders::Geocoder
- Inherits:
-
Object
- Object
- GeoKit::Geocoders::Geocoder
- Defined in:
- lib/geo_kit/geocoders.rb
Overview
The Geocoder base class which defines the interface to be used by all other geocoders.
Direct Known Subclasses
CaGeocoder, GoogleGeocoder, IpGeocoder, MultiGeocoder, UsGeocoder, YahooGeocoder
Class Method Summary collapse
-
.call_geocoder_service(url) ⇒ Object
Call the geocoder service using the timeout if configured.
-
.geocode(address) ⇒ Object
Main method which calls the do_geocode template method which subclasses are responsible for implementing.
Class Method Details
.call_geocoder_service(url) ⇒ Object
Call the geocoder service using the timeout if configured.
62 63 64 65 66 67 |
# File 'lib/geo_kit/geocoders.rb', line 62 def self.call_geocoder_service(url) timeout(GeoKit::Geocoders::timeout) { return self.do_get(url) } if GeoKit::Geocoders::timeout return self.do_get(url) rescue TimeoutError return nil end |
.geocode(address) ⇒ Object
Main method which calls the do_geocode template method which subclasses are responsible for implementing. Returns a populated GeoLoc or an empty one with a failed success code.
56 57 58 59 |
# File 'lib/geo_kit/geocoders.rb', line 56 def self.geocode(address) res = do_geocode(address) return res.success ? res : GeoLoc.new end |