Requirements GeoIP C Library must be installed to run Ruby API.
Usage
Net::GeoIP::TYPE_DISK >> access type constant
Net::GeoIP::TYPE_RAM >> access type constant
g = Net::GeoIP.new([access_type])
g = Net::GeoIP.open(db_filename[, access_type])
g.country_code_by_addr('127.0.0.1') >> 'US'
g.country_code_by_name('yahoo.com') >> 'US'
g.country_code3_by_addr('127.0.0.1') >> 'USA'
g.country_code3_by_name('yahoo.com') >> 'USA'
g.country_name_by_addr('127.0.0.1') >> 'United States'
g.country_name_by_name('yahoo.com') >> 'United States'
g.country_id_by_addr('127.0.0.1') >> 225
g.country_id_by_name('yahoo.com') >> 225
g.region_by_addr('127.0.0.1') >> ?? Can't test this
g.region_by_name('yahoo.com') >> ?? Can't test this
g.database_info() >> Misc database info
g.update_database(your_key_here[,debug]) >> Updates your database
There is an updated net-geoip module with support for GeoIP City available
from RubyForge (SVN checkout required).
There is a patch available to add GeoIP ISP/Organization support.
Michal Safranek has contributed a geoipupdate alternative for automating the updates of GeoIP Country.
Credits
Thanks to Sean Chittenden for writing the GeoIP Ruby API.