Which ruby ​​geoip ruby ​​wrapper has up2date and can be used? (for commercial library)

I am trying to get below github repo in my application



I tried adding it like

gem "geoip", :git => "git://github.com/mtodd/geoip.git"


Error =

Could not find gem 'geoip (>= 0) ruby' in git://github.com/mtodd/geoip.git (at master).
Source does not contain any versions of 'geoip (>= 0) ruby'


Is there a ruby ​​skin for GeoIP compatible with LATEST GEOIP? Ive searched for a very long time for one, the one above seems to be compatible with 1.4.7 and up, but I cant install it, any other suggestion? thank!


source to share

2 answers

I have this in my Gemfile:

gem "geoip-c", '~> 0.7.1', :git => "git://github.com/mtodd/geoip.git"


As far as I know, it is fully compatible.



I know this was posted a few years ago, but I was recently unable to find a good modern stone for this. I found Geoip2 from YotpoLtd .

In my Gemfile

gem 'geoip2'


Setting / Setting

Geoip2.configure do |conf|
     # Mandatory
     conf.license_key = 'Your MaxMind License Key'
     conf.user_id = 'Your MaxMind User Id'

     # Optional
    conf.host = 'geoip.maxmind.com' # Or any host that you would like to work with
    conf.base_path = '/geoip/v2.0' # Or any other version of this API
    conf.parallel_requests = 5 # Or any other amount of parallel requests that you would like to use



data = Geoip2.omni('') #this call is synchronous


* note: I believe you can replace "omni" with the product level name: city, country, etc.

Errors If there is an error, the returned hash will have an error object, so just check for its existence

if data.error
    # error handling
else #still might want to check for data existence ( if data )
    #access object as you will


For more information on the returned hash, see the MaxMind Web Services Documentation



All Articles