Sha256: e2c13a9501687c9d4b652f44b72b3b5b3a38ead695d4c3ab0900fd2e718f0977
Contents?: true
Size: 721 Bytes
Versions: 5
Compression:
Stored size: 721 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.kind_of?(Numeric) && res.latitude.kind_of?(Numeric) ) loc end end end end
Version data entries
5 entries across 5 versions & 1 rubygems