Project

ipdb

0.0
No commit activity in last 3 years
No release in over 3 years
ipdb is a ruby interface to the ipinfodb IP geographical locator api.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.2.9
>= 0.2.3.5

Runtime

>= 1.4.0
 Project Readme

ipdb¶ ↑

DESCRIPTION:¶ ↑

IpDB is a simple ruby interface to the ipinfodb IP geographical locator api.

INSTALL:¶ ↑

$ sudo gem install ipdb

SYNOPSIS:¶ ↑

Using IpDB is super simple. Here are a few example of how one may use this gem.

Look up my current external address:

ip = Ipdb::Query.new.parse

puts ip.address #=> '127.0.0.1'

Get geographical information for a given address:

ip = Ipdb::Query.new('173.45.230.150').parse

puts ip.latitude      #=> 38.6446
puts ip.longitude     #=> -90.2533
puts ip.country       #=> United States
puts ip.region        #=> Missouri
puts ip.city          #=> Saint Louis

Return the hostname & city for each address and/or domain in an array.

ips = ['127.0.0.1', 'snorby.org', '64.13.134.52']

Ipdb::Query.new(ips, :timeout => 1).each do |ip|
 puts ip.hostname
 puts ip.city
end

Render a google map from an array of IP addresses:

@map = Ipdb::Map.new(ip_array, :width => 600, :height => 350, :units => :px).render

Or if you’re using Rails:

Controller:

@map = Ipdb::Map.new(ip_array, :width => 600, :height => 350, :units => :px)

View:

<%= @map.render %>

Thats It! Below is a screenshot of its output:

Nice! If you zoom out some you get this:

FEATURES/PROBLEMS:¶ ↑

  • IP/Domain geographical location

  • Look up multiple addresses at once.

  • Convenience Methods for Google Maps

  • No API usage limit.

  • Timezone data is from Geonames. Please refer to Geonames.org for more info about timezones.

  • A max of 25 addresses can be parsed during a single query.

  • There is a one second pause when querying domain names.

REQUIREMENTS:¶ ↑

LICENSE:¶ ↑

(The MIT License)

Copyright © 2009 Dustin Willis Webber

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.