Sha256: f1d678c0f72b5f8c08511895e2b0e8d4cb1d8beb0c8d3950a74b3a81844e02e5
Contents?: true
Size: 628 Bytes
Versions: 2
Compression:
Stored size: 628 Bytes
Contents
require 'geocoder' module Msewage::Importer class Geolocator def initialize(config = Config.new) #Geocoder.configure do |c| # #c.lookup = :bing # #c.api_key = config.geocoder.bing_key # c.lookup = :google # #c.lookup = :nominatim # #c.lookup = :yandex # #c.lookup = :mapquest # #c.lookup = :freegeoip #end @config = config end def geolocate(location) result = Geocoder.search(location) result = result.first if result.is_a?(Array) result.nil? ? nil : result.coordinates end private attr_reader :config end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
msewage-importer-0.0.2 | lib/msewage-importer/geolocator.rb |
msewage-importer-0.0.1 | lib/msewage-importer/geolocator.rb |