Sha256: 6f42adda51605a95b72c31be29d925b7eca26692db4fbe6c65dafc751b4581cf
Contents?: true
Size: 358 Bytes
Versions: 3
Compression:
Stored size: 358 Bytes
Contents
require 'net/http' require 'json' class Geo GEO_LOCATION_SERVICE_URL = "http://freegeoip.net/json/" attr_reader :url def initialize @url = GEO_LOCATION_SERVICE_URL end def quote ip_address=nil quote_url = ip_address ? "#{url}#{ip_address}" : url uri = URI.parse(URI.escape(quote_url)) JSON.parse(Net::HTTP.get(uri)) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
meteo-1.1.2 | lib/meteo/geo.rb |
meteo-1.1.1 | lib/meteo/geo.rb |
meteo-1.1.0 | lib/meteo/geo.rb |