Sha256: f58952201a612bfd55eef914f16a01c3f8e599d6b69512ef53cd575111cc2bec

Contents?: true

Size: 304 Bytes

Versions: 2

Compression:

Stored size: 304 Bytes

Contents

require 'uri'
require 'open-uri'

module Ipgeobase
  URL = 'http://ipgeobase.ru:7020/geo'
  autoload 'IpMetaData', 'ipgeobase/ip_meta_data'

  def self.lookup(ip)
    uri = URI.parse(URL)
    uri.query = URI.encode_www_form :ip => ip
    resp = open(uri).read()
    IpMetaData.parse(resp.to_s)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ipgeobase-0.1.2 lib/ipgeobase.rb
ipgeobase-0.1.1 lib/ipgeobase.rb