Sha256: d95b1d56180f780427eb85e5457baefb321ae9a4085e7b3d76ce4b71915a0064
Contents?: true
Size: 874 Bytes
Versions: 1
Compression:
Stored size: 874 Bytes
Contents
require 'geocoder/lookups/base' require 'geocoder/results/telize' module Geocoder::Lookup class Telize < Base def name "Telize" end def query_url(query) #currently doesn't support HTTPS "http://www.telize.com/geoip/#{query.sanitized_text}" end private # --------------------------------------------------------------- def results(query) # don't look up a loopback address, just return the stored result return [reserved_result(query.text)] if query.loopback_ip_address? if (doc = fetch_data(query)).nil? or doc['code'] == 401 or empty_result?(doc) [] else [doc] end end def empty_result?(doc) !doc.is_a?(Hash) or doc.keys == ["ip"] end def reserved_result(ip) {"message" => "Input string is not a valid IP address", "code" => 401} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geocoder-1.2.3 | lib/geocoder/lookups/telize.rb |