GeoIpClient
GeoIpClient is a simple gem which allows you to speak with your RubyGeoIp server.
Installation
Add this line to your application's Gemfile:
gem 'geo_ip_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install geo_ip_client
Configuration
Edit your config/initializers/geo_ip_client.rb
like:
GeoIpClient.configure do |config|
config.server_path = "" # Insert the location of your server
config.secret_key = nil # Inser your secret key if your RubyGeoIp server requires it
end
Usage
> GeoIpClient.search("64.71.22.18")
=> {"request"=>"64.71.22.18", "ip"=>"64.71.22.18", "country_code2"=>"US", "country_code3"=>"USA", "country_name"=>"United States", "continent_code"=>"NA", "region_name"=>"CA", "city_name"=>"Santa Clara", "postal_code"=>"95054", "latitude"=>37.39609999999999, "longitude"=>-121.96170000000001, "dma_code"=>807, "area_code"=>408, "timezone"=>"America/Los_Angeles"}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request