- Ruby 2.5.1
- Rails 5.2.1
- Rubygems
- Bundler
- PostgreSQL
- Install all dependencies
- Run
bundle install rails db:createandrails db:migrate- Run
rails -s - Run the test suite with
rspec -fd
/users GET, POST
/user_token POST
/users/:user_id/conversations GET
/users/:user_id/conversations/:conversation_id/adduser POST
/conversations GET
/conversations/:conversation_id/messages GET, POST
To create a user send a POST request using Postman to localhost:3000/users
Example:
{
"user": {
"username": "foobar",
"email": "[email protected]",
"password": "password",
"password_confirmation": "password"
}
}To list all of the users, send a GET request to localhost:3000/users
To authenticate a user, send a POST request to localhost:3000/user_token
Example:
{
"auth": {
"email": "[email protected]",
"password": "password"
}
}To create a conversation you must first authenticate a user as done above.
Upon authentication, you should recieve a Json Web Token(JWT). Place That
JWT as a bearer token in Postman's authorization header.
Send a POST request to localhost:3000/conversations
Example:
{
"conversation": {
"name": "conversation1"
}
}Send a POST request to localhost:3000/users/:user_id/conversations/:conversation_id/adduser
with the User ID and the Conversation ID
After authenticated(see above) you can list all of the conversations that
a user is a part of.
Send a GET request to localhost:3000/user/:user_id/conversations
Send a POST request to localhost:3000/conversations/:id/messages
Example:
{
"message": {
"body": "Sending a message"
}
}Send a GET request to localhost:3000/conversations/:id/messages