Test Submission Document is located here.
This is an example application to be used for DevOps technical challenges. It is a simple REST api that implements the technical challenge found in this folder.
- This project has been tested on Ubuntu 19.04.
- Ensure that you have Ruby 2.6.3 available on your system. RVM can be helpful for this.
- The project is currently configured to use a PostgreSQL v11.5 (although any version should work)
database and assumes that it is running on localhost on the default port.
It connects using the
postgres
user and assumes that you've configured PostgreSQL to allow unauthenticated local connections. See this link if you need help setting this up. Alternatively, you can changeconfig/database.yml
to useSQLite3
. In production, however, PostgreSQL should be used. In theGemfile
both gems are installed. - From the root of this project, run
bundle install
. This will install all of the required gems. - From the root of this project, run
rails db:setup
. This will create the required databases and schema. - To run the application, run
rails s
. This should start the server and the application should be available athttp://localhost:3000
- To run the specs, you can run
rails spec
.
- Create a new user http://localhost:3000/users/create
- requires the following parameters:
- username (string, required)
- password (string, required, min length of 6)
- returns a JSON representation of the new user's API key
{ "data": { "id": "3", "type": "user", "attributes": { "api_key": "XwN5iq2RR4Aif4zUSTA1UBQc" } }, "jsonapi": { "version": "1.0" } }
- GET the user's current integer http://localhost:3000/api/v1/integer
- requires that the user's API key be passed as a Bearer token in the Authorization header
- returns JSON representing the user's current integer
{ "data": { "id": "3", "type": "user_integer", "attributes": { "value": 1 } }, "jsonapi": { "version": "1.0" }
3. Increment the user's current integer by 1 (PUT) http://localhost:3000/api/v1/integer/increment
- requires that the user's API key be passed as a Bearer token in the Authorization header
- returns JSON representing the user's current integer after it's been incremented
```
{
"data": {
"id": "3",
"type": "user_integer",
"attributes": {
"value": 4
}
},
"jsonapi": {
"version": "1.0"
}
}
```
4. Update the user's current integer (PUT) http://localhost:3000/api/v1/integer
- requires that the user's API key be passed as a Bearer token in the Authorization header
- returns JSON representing the user's current integer after it's been updated
```
{
"data": {
"id": "3",
"type": "user_integer",
"attributes": {
"value": 10
}
},
"jsonapi": {
"version": "1.0"
}
}
```