| Class | GeoKit::Geocoders::Geocoder |
| In: |
vendor/plugins/geokit/lib/geo_kit/geocoders.rb
|
| Parent: | Object |
The Geocoder base class which defines the interface to be used by all other geocoders.
Call the geocoder service using the timeout if configured.
# File vendor/plugins/geokit/lib/geo_kit/geocoders.rb, line 63
63: def self.call_geocoder_service(url)
64: timeout(GeoKit::Geocoders::timeout) { return self.do_get(url) } if GeoKit::Geocoders::timeout
65: return self.do_get(url)
66: rescue TimeoutError
67: return nil
68: end
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.
# File vendor/plugins/geokit/lib/geo_kit/geocoders.rb, line 57
57: def self.geocode(address)
58: res = do_geocode(address)
59: return res.success ? res : GeoLoc.new
60: end