API interface for http://ipinfodb.com/
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
README.rdoc
TODO
init.rb

README.rdoc

IpInfoDb

API interface to ipinfodb.com/ Supports caching when used with rails

Example

>> ip_info = Marjan::IpInfoDb.lookup '217.196.166.138'
=> {"217.196.166.138"=>#<Marjan::IpInfoDb::Location status="OK", country_name="Ukraine", ip="217.196.166.138", region_name="Ternopil's'ka Oblast'", city="Ternopil", zip_postal_code="", region_code="22", longitude="25.5833", id="0", country_code="UA", latitude="49.55">}

Marjan::IpInfoDb.lookup ['217.196.166.137', 'google.com']
=> {"google.com"=>#<Marjan::IpInfoDb::Location status="OK", zip_postal_code="72023", country_name="United States", region_code="05", ip="66.249.91.104", city="Cabot", longitude="-92.0858", latitude="34.9461", country_code="US", id="1", region_name="Arkansas">, "217.196.166.137"=>#<Marjan::IpInfoDb::Location status="OK", zip_postal_code="", country_name="Ukraine", region_code="22", ip="217.196.166.137", city="Ternopil", longitude="25.5833", latitude="49.55", country_code="UA", id="0", region_name="Ternopil's'ka Oblast'">}

>> ip_info = Marjan::IpInfoDb.lookup 'wrong ip or host'
=> nil

Installation

In Rails:

  • as plugin:

    ./script/plugin install git://github.com/krekoten/marjan_ip_info_db.git

  • as gem coming soon…

Other:

  • as gem coming soon…

Author

Copyright © 2010 Marjan Krekoten <krekoten@gmail.com>, released under the MIT license