Sha256: b596b427a907b426cd370c636a8b7a380a8d7f133d649d910eda59b6583eeb29
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
module Geokit module Geocoders # Provides geocoding based upon an IP address. The underlying web service is MaxMind class MaxmindGeocoder < Geocoder config :geoip_data_path # path to GeoLiteCity.dat private def self.do_geocode(ip) res = GeoIP.new(geoip_data_path).city(ip) loc = new_loc loc.lat = res.latitude loc.lng = res.longitude loc.city = res.city_name loc.state = res.region_name loc.zip = res.postal_code loc.country_code = res.country_code2 loc.success = (res.longitude.is_a?(Numeric) && res.latitude.is_a?(Numeric)) loc end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geokit-1.10.0 | lib/geokit/geocoders/maxmind.rb |