ruby 2.7.1
rails 6.0.3
postgres 12
Docker
This API receives an incoming order, parses it and send the parsed result to other API.
To run the project ensure that you have docker and docker-compose installed and follow this instructions:
# add .env to project
mv .env.sample .env
# build project
docker-compose build
# start the server
docker-compose up
# in other terminal run the following to preprate DB and its deps
docker-compose exec web bin/setup
# to access the container run
docker-compose exec web bash
Inside the web container run:
# lint the code
rubocop
# run test suit
rspec
Coverage report can be found at coverage/index.html
.
To create a new order you must send a post request containing the raw order data. e.g:
verb
-POST
endpoint
-/api/v1/order
body
- spec/fixtures/raw_order.json
curl -H 'Content-Type: application/json' \
-d @spec/fixtures/raw_order.json \
'http://localhost/api/v1/orders'
-
Possible responses:
- 201 - Successfully created
- 422 - Cant create order, please check your params
- 503 - Cant send order to remote server