Firstly, install and set-up docker:
https://docs.docker.com/engine/installation#on-linux
or
https://docs.docker.com/engine/installation#on-osx-and-windows
Then pull the latest docker images and execute it:
git clone https://github.com/rickclare/reachrobotics_challenge
cd reachrobotics_challenge
# either
docker-compose pull # pull pre-built image from Docker Hub (this may take a few minutes)
# or
docker-compose build # build using latest local source code (this will take several minutes)
docker-compose up web
curl -k https://`docker-machine ip`/api/v1/mekamons # Docker-machine on OS X or Windows
curl -k https://localhost/api/v1/mekamons/2 # Native docker on linux
curl https://reachrobotics-challenge-rick.herokuapp.com/api/v1/mekamons # Heroku hosted service
docker-compose run test_specs
This service takes the following steps to ensure security.
POST /api/v1/auth
Example:
curl -ki -X POST -H "Content-Type: application/json" -d '{
"email": "[email protected]",
"password": "12345678",
"name": "John Smith",
"address_line_1": "1 The Larch",
"address_line_2": "Larchington",
"city": "Larchington",
"county": "Larchinshire",
"postcode": "LN1 1XX"
}' https://reachrobotics-challenge-rick.herokuapp.com/api/v1/auth
POST /api/v1/auth/sign_in
This results in a HTTP response with headers access-token and client that can be used a subsequent request that require authentication.
Example:
curl -ki -X POST -H "Content-Type: application/json" -d '{
"email": "[email protected]",
"password": "12345678"
}' https://reachrobotics-challenge-rick.herokuapp.com/api/v1/auth/sign_in
DELETE /api/v1/auth/sign_out
Example below. Note, the request header values for access-token and client need to be obtained first (from response-header in a previous API request, or via POST /api/v1/auth/sign_in request)
curl -ki -X DELETE -H "access-token: xxxx" -H "client: yyyy" -H "uid: [email protected]" https://reachrobotics-challenge-rick.herokuapp.com/api/v1/auth/sign_out
DELETE /api/v1/auth
Example below. Note, the request header values for access-token and client need to be obtained first (from response-header in a previous API request, or via POST /api/v1/auth/sign_in request)
curl -ki -X DELETE -H "access-token: xxxx" -H "client: yyyy" -H "uid: [email protected]" https://reachrobotics-challenge-rick.herokuapp.com/api/v1/auth
GET /api/v1/user
Example below. Note, the request header values for access-token and client need to be obtained first (from response-header in a previous API request, or via POST /api/v1/auth/sign_in request)
curl -ki -H "access-token: xxxx" -H "client: yyyy" -H "uid: [email protected]" https://reachrobotics-challenge-rick.herokuapp.com/api/v1/user
GET /api/v1/user/mekamons
Note: This currently returns dummy data
Example below. Note, the request header values for access-token and client need to be obtained first (from response-header in a previous API request, or via POST /api/v1/auth/sign_in request)
curl -ki -H "access-token: xxxx" -H "client: yyyy" -H "uid: [email protected]" https://reachrobotics-challenge-rick.herokuapp.com/api/v1/user/mekamons
GET /api/v1/mekamons
curl -k https://reachrobotics-challenge-rick.herokuapp.com/api/v1/mekamons
GET /api/v1/mekamons/:id
curl -k https://reachrobotics-challenge-rick.herokuapp.com/api/v1/mekamons/3
GET /api/v1/user/games
Note: This currently returns dummy data
Example below. Note, the request header values for access-token and client need to be obtained first (from response-header in a previous API request, or via POST /api/v1/auth/sign_in request)
curl -ki -H "access-token: xxxx" -H "client: yyyy" -H "uid: [email protected]" https://reachrobotics-challenge-rick.herokuapp.com/api/v1/user/games
Content type
Image
Digest
Size
141.4 MB
Last updated
over 10 years ago
docker pull rickclare/reachrobotics_challenge