Geocoder challenge

CircleCI

Install dependencies

gem install bundler
bundle install

Setup credentials

Generate credentials

EDITOR="nano" bundle exec rails credentials:edit

Update it with your secret_key_base and google_geocoder_api_key

secret_key_base: your_secret_key_base
google_geocoder_api_key: your_google_geocoder_api_key

Setup database

bundle exec rake db:create db:migrate db:seed

Run server

bundle exec rails s

Usage examples

Authenticate user

curl -H "Content-Type: application/json" -X POST -d '{"email":"user@test.xx","password":"test1234"}' http://localhost:3000/api/v1/authenticate
{"auth_token":"eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1Mzg3NzczODR9.d4Fl0gQ587b1GFaUGh3eoxCWbdDW5Btkq9ABojV509U"}

Use geocoder

curl -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJleHAiOjE1Mzg3NzczODR9.d4Fl0gQ587b1GFaUGh3eoxCWbdDW5Btkq9ABojV509U" http://localhost:3000/api/v1/geocode\?address\=checkpoint+charlie
{"lat":52.5074434,"lng":13.3903913}

Testing

Run rubocop

bundle exec rubocop

Run tests

bundle exec rspec