everydayrails / everydayrails-rspec-2017

Sample source for the 2017 edition of Everyday Rails Testing with RSpec.
http://rspectutorial.com
312 stars 247 forks source link

Chapter 10, Geocoder now requires API key for Ipstack #84

Closed JunichiIto closed 6 years ago

JunichiIto commented 6 years ago

In this book, the VCR cassette simulates a request to freegeoip.io, but freegeoip.io (freegeoip.net) was discontinued on July 1st, 2018. So if you want to recreate the cassette, it fails now.

You need these steps to do so:

  1. Get Ipstack's free API key (See https://ipstack.com/product )
  2. bundle update geocoder
  3. Create config/initializers/geocoder.rb
# config/initializers/geocoder.rb
Geocoder.configure(ip_lookup: :ipstack, api_key: "(your-api-key)")

Please see also:

However the API key is credential, so it must be hidden from geocoder.rb and VCR cassettes in GitHub repository. It might require some more complicated steps😔

ruralocity commented 6 years ago

That's unfortunate—the only reason I added the geocoding feature to the sample app was so I could develop/test against an API that didn't require readers to get API keys. I'll try to address this in a blog post at least in the next couple of weeks.

ruralocity commented 6 years ago

Released.