geoplugin

This is a Ruby wrapper library around the API provided by Geoplugin (http://www.geoplugin.com).

Geoplugin

This is a Ruby wrapper library around the API provided by Geoplugin. Geoplugin is the easiest way for you to know where your visitors are from so that you can provide them with content more relevant to their geographical location.

See it in action!

You can try Geoplugin live at this little demo: https://geopweb.herokuapp.com

Installation

Add this line to your application’s Gemfile:

gem 'geoplugin'

And then execute:

$ bundle

Or install it yourself as:

$ gem install geoplugin

Usage

require 'geoplugin'

# Find my location without ssl
location = Geoplugin.me

# Find my location with ssl
location = Geoplugin.me(:ssl => true, :key => 'your geoplugin key')

# Find ip location with ssl
location = Geoplugin.new('8.8.8.8')

# Find my location with ssl
location = Geoplugin.new('8.8.8.8', :ssl => true, :key => 'your geoplugin key')

#Like all calls to any of geoPlugin's web services, the default base_currency is USD ($US). 
#Thus, if your base currency is NOT $US, then you must add the variable base_currency=XXX to the call like this:

location = Geoplugin.new('151.72.254.22', :base_currency => "EUR")
location = Geoplugin.me(:base_currency => "EUR")

To use the SSL web services, an inexpensive key is required.

Attributes

request,
status,
city,
region,
areacode,
dmacode,
countrycode,
countryname,
continentcode,
latitude,
longitude,
regioncode,
regionname,
currencycode,
currencysymbol,
currencysymbol_utf,
currencyconverter

Credits

Many thanks to Geoplugin for his implementation of the API.
Geoplugin includes GeoLite data created by MaxMind, available from
http://www.maxmind.com.

License

The restcountry GEM is released under the MIT License.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/geoplugin/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request