Geo IP gem look up the city, state, country information with given IP address and store it in database as a cache. It provides helper function calls to other gems or your application code.
You will need account from maxmind.com, have purchase the queries for GeoIP2 Precision: City to use this gem.
call country_id to get the country id state_code to ge the country iso code country_code_from_ip(ip) state_code_from_ip(ip) city_from_ip(ip) in your view templates.
Add spree_ip_geo to your Gemfile:
gem 'spree_ip_geo'
Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g spree_ip_geo:install
First bundle your dependencies, then run rake
. rake
will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app
.
bundle
bundle exec rake
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
require 'spree_ip_geo/factories'
Contact albertliu at naturalwellbieng.com for bugs, issues.
Copyright (c) 2015 naturalwellbeing.com, released under the New BSD License