geocoder/izi_lookup

One more useless plugin

Usage

How to use my plugin.

Installation

Add this line to your application's Gemfile:

gem 'geocoder'
gem 'geocoder-izi-lookup', require: 'geocoder/izi_lookup'

And then execute:

$ bundle

Or install it yourself as:

$ gem install geocoder-izi-lookup

Now you can use this configuration to use own lookup service:

Geocoder.configure(
  cache: Rails.cache,
  cache_prefix: 'geocoder:',
  ip_lookup: :izi_geoip,
  izi_geoip: {
    host: 'https://[YOUR_LOOKUP_SERVICE]'
  }
)

your service should respond by url:

https://[YOUR_LOOKUP_SERVICE]/geocode.json?ip=[IP_FOR_LOOKUP]

and return value:

{
  "ip": "123.45.67.89",
  "continent_code": "EU",
  "continent_name": "Europe",
  "country_code": "UA",
  "country_name": "Ukraine",
  "location_latitude": "",
  "location_longitude": "",
  "location_time_zone": "",
  "postal_code": "",
  "version": "0.1.1",
  "in_eu": "false"
}

server writen on Crystal here: https://hub.docker.com/r/izikaj/geoip/

Contributing

Contribution directions go here. TODO

Tests

TODO

License

The gem is available as open source under the terms of the MIT License.