Skip to content

Instantly share code, notes, and snippets.

@benoittgt
Created March 4, 2015 18:48
Show Gist options
  • Save benoittgt/187256cfe266f49c84ad to your computer and use it in GitHub Desktop.
Save benoittgt/187256cfe266f49c84ad to your computer and use it in GitHub Desktop.
Geocoder behing QuotaGuard on Heroku
Running `rails console` attached to terminal... up, run.8280
Loading production environment (Rails 4.2.0)
irb(main):001:0> Geocoder.search("12 rue de Rivoli Paris")
Geocoder::ResponseParseError: Geocoder::ResponseParseError
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:159:in `raise_error'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:186:in `rescue in parse_json'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:180:in `parse_json'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:193:in `parse_raw_data'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:169:in `fetch_data'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/google.rb:28:in `results'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/lookups/base.rb:47:in `search'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder/query.rb:11:in `execute'
from /app/vendor/bundle/ruby/2.0.0/gems/geocoder-1.2.7/lib/geocoder.rb:20:in `search'
from (irb):1
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require'
from /app/bin/rails:8:in
@benoittgt
Copy link
Author

And for geoip

    from /app/bin/rails:8:in `<main>'irb(main):007:0> Geocoder.search('8.8.8.8') 
=> [#<Geocoder::Result::Freegeoip:0x007f5b2860d490 @data={"ip"=>"8.8.8.8", "country_code"=>"US", "country_name"=>"United States", "region_code"=>"CA", "region_name"=>"California", "city"=>"Mountain View", "zip_code"=>"94040", "time_zone"=>"America/Los_Angeles", "latitude"=>37.386, "longitude"=>-122.084, "metro_code"=>807}, @cache_hit=nil>]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment