Ruby 2.5.1 | Rails 5.2
This project provides an API that does geocoding. It retrieves coordinates from an address.
The service is an interface to other geocoding APIs. For now, it implements the google API only, but can easily be extended.
Note: The master.key
file and the default access credentials are provided separately
- Clone this repo
- Open a terminal in the project folder and install the dependencies via the command
bundle
- Copy the
master.key
file into the folderapp/config
- Start the server:
rails s
. It will be available onhttp://localhost:3000
The API is accessible via the endpoint /v1/coordinates?address=checkpoint%20charlie
with the searched address as a param.
An API documentation is provided on the endpoint /api/docs
.
The access to the different endpoints (API and documentation) are restricted via HTTP basic authentication.
To use the API, you should include an Authorization
header in your requests.
Example: Authorization: Basic <credentials>
where is login:password
base-64 encoded.
The credentials (login/password and third-party api credentials) are stored in app/config/credentials.yml/enc
.
To read/edit the credentials, you need to have the file master.key
in the app/config
folder.
(More information about encrypted credentials in Rails 5.2 here
The configuration of third party APIs is managed via a config file: config/third_party_api.yml
The credentials (i.e. API key) are managed via the encrypted credentials solution described above.
Tests are written via rspec
and can be run with bundle exec rspec