geo lite city

Because sometimes you need just SQL only.

Installation

gem install geo-lite-city

Usage

require "geo"
Geo.city("8.8.8.8")

returns

{
      area_code: 650,
       dma_code: 807,
      city_name: "Mountain View",
 continent_code: "NA",
   country_code: "NA.US"
  country_code2: "US",
  country_code3: "USA",
   country_name: "United States",
             ip: "8.8.8.8",
       latitude: 37.385999999999996,
      longitude: -122.0838,
           name: "Mountain View, CA, United States",
    postal_code: "",
    region_code: "NA.US.CA",
    region_name: "CA",
        request: "8.8.8.8",
       timezone: "America/Los_Angeles",
}

License

The geo-lite-city gem is distributed under the terms of the Modified BSD License, see LICENSE.BSD for details.

The file GeoLiteCity.dat, which is distributed with this gem, is (c) MaxMind, distributed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.

Using this gem might require you to attribute the usage of the MaxMind databases by including the following in all advertising and documentation mentioning features of or use of this database:

  This product includes GeoLite data created by MaxMind, available from
  <a href="http://www.maxmind.com">http://www.maxmind.com</a>.