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
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install geoplugin
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('184.108.40.206') # Find my location with ssl location = Geoplugin.new('220.127.116.11', :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('18.104.22.168', :base_currency => "EUR") location = Geoplugin.me(:base_currency => "EUR")
To use the SSL web services, an inexpensive key is required.
request, status, city, region, areacode, dmacode, countrycode, countryname, continentcode, latitude, longitude, regioncode, regionname, currencycode, currencysymbol, currencysymbol_utf, currencyconverter
Many thanks to Geoplugin for his implementation of the API. Geoplugin includes GeoLite data created by MaxMind, available from http://www.maxmind.com.
The restcountry GEM is released under the MIT License.
- Fork it ( https://github.com/[my-github-username]/geoplugin/fork )
- 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 a new Pull Request