This is the solution for a job application challenge.
See the challenge file for a specific description about it and details about the implementation.
This is a REST API made with Ruby on Rails that exposes 4 endpoints:
Parameters:
email: string
password: string
Parameters:
email: string
Parameters:
"client_id": integer,
"source_account_id": integer,
"destination_account_id": integer,
"amount": integer
Parameters:
id: integer
The following are examples on how you can send requests against the API the Curl terminal tool.
Feel free to use any HTTP client of your preference, though.
** Note that these examples use seed data already fed into the database when you start the API server. This also assumes you started the API on the default 3000 port on your local environment * *
- Logging in
curl -i -H Content-Type\:\ application/json -XPOST http\://localhost\:3000/login -d \{'
'\ \ \ \ \"email\"\:\ \"tobias\@email.com\"\,'
'\ \ \ \ \"password\"\:\ \"encpass2\"'
'\}'
'
- Logging out
curl -i -H Content-Type\:\ application/json -XDELETE http\://localhost\:3000/logout -d \{'
'\ \ \ \ \"email\"\:\ \"tobias\@email.com\"'
'\}'
'
- Getting an account balance
curl -i -XGET http\://localhost\:3000/balance\?id\=1
- Making a transfer
curl -i -H Content-Type\:\ application/json -XPOST http\://localhost\:3000/transfer -d \{'
'\ \ \ \ \"client_id\"\:\ 2\,'
'\ \ \ \ \"source_account_id\"\:\ 2\,'
'\ \ \ \ \"destination_account_id\"\:\ 3\,'
'\ \ \ \ \"amount\"\:\ 5000'
'\}'
'
See the contributing file.