Sha256: f55a140348d589b584b8d93a7a3c4b79c14b6cc81d92dae10690baeb3453d0cb
Contents?: true
Size: 979 Bytes
Versions: 3
Compression:
Stored size: 979 Bytes
Contents
module Geokit module Geocoders # Provides geocoding based upon an IP address. The underlying web service is freegeoip.net class FreeGeoIpGeocoder < BaseIpGeocoder private def self.do_geocode(ip, _=nil) warn '[DEPRECATION] `freegeoip` is deprecated. Please use `ipstack`'\ ' instead. You can find more at'\ ' https://github.com/apilayer/freegeoip#readme' process :xml, ip end def self.submit_url(ip) "http://freegeoip.net/xml/#{ip}" end XML_MAPPINGS = { city: 'City', state: 'RegionCode', zip: 'ZipCode', country_code: 'CountryCode', lat: 'Latitude', lng: 'Longitude', } def self.parse_xml(xml) loc = new_loc set_mappings(loc, xml.elements['Response'], XML_MAPPINGS) loc.success = !!loc.city && !loc.city.empty? loc end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
geokit-1.13.1 | lib/geokit/geocoders/free_geo_ip.rb |
geokit-1.13.0 | lib/geokit/geocoders/free_geo_ip.rb |
geokit-1.12.0 | lib/geokit/geocoders/free_geo_ip.rb |