Ruby on rails 哪个maxmind geoip ruby包装器是可使用的?(适用于商业图书馆)

Ruby on rails 哪个maxmind geoip ruby包装器是可使用的?(适用于商业图书馆),ruby-on-rails,ruby-on-rails-3.1,geolocation,geoip,Ruby On Rails,Ruby On Rails 3.1,Geolocation,Geoip,我试图在我的应用程序中低于github repo https://github.com/mtodd/geoip 我试着像这样添加它 gem "geoip", :git => "git://github.com/mtodd/geoip.git" 错误= Could not find gem 'geoip (>= 0) ruby' in git://github.com/mtodd/geoip.git (at master). Source does not contain any

我试图在我的应用程序中低于github repo

https://github.com/mtodd/geoip
我试着像这样添加它

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

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'
是否有与最新GeoIP兼容的用于GeoIP的ruby gem包装器?
我搜索了很长时间,上面的一个似乎与1.4.7和更高版本兼容,但我无法安装,还有其他建议吗?谢谢

我的档案中有:

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

据我所知,它是完全兼容的。

我知道这是几年前发布的,但我最近很难找到一个好的最新的宝石。我发现的是

在我的文件中

gem 'geoip2'
设置/配置

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
end
data = Geoip2.omni('0.0.0.0') #this call is synchronous
使用

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
end
data = Geoip2.omni('0.0.0.0') #this call is synchronous
*注意:我相信您可以将“omni”替换为产品层的名称:城市、国家等

错误 如果有错误,返回的哈希将有一个错误对象,因此只需检查它的存在

if data.error
    # error handling
else #still might want to check for data's existence ( if data )
    #access object as you will
    data.city.names.en
    data.postal.code
end

有关返回的散列的更多信息,请参阅我稍后遇到的

,事实上,该散列似乎工作正常,thx。虽然git部分对我不起作用,但如果没有它,我会很顺利