Sha256: e48315af5d5818ab782f7b3020e5aa7de66d94527481dadee6bd1f84e5dd9310
Contents?: true
Size: 708 Bytes
Versions: 1
Compression:
Stored size: 708 Bytes
Contents
module Where class IpAddress < Where::Base class << self GEOCODER_URL = 'http://www.geoplugin.net/json.gp?ip=' def geocode(address, api_url=nil) super(address, api_url || GEOCODER_URL) end end def initialize(body="") data = body[10..-2] || "" super(data.empty? ? data : data.gsub('geoplugin_', '')) end def latitude=(val) @lat = val end def longitude=(val) @lng = val end def accuracy return 'street_address' unless street.nil? return 'city' unless city.nil? return 'region' unless region.nil? return 'country' unless country.nil? "" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
where-0.0.1 | lib/where/ip_address.rb |