An API to store contacts in a list to manage the last time each contact was contacted.
Link to front end: https://github.com/rdelvallej32/catch_up_frontend/tree/master
Link to back end: https://github.com/rdelvallej32/catch_up_api
Link to wireframes: https://app.moqups.com/rdelvallej@gmail.com/jOKx4Yfb/edit/page/a4f24c2e8
Ruby, Rails
PostgreSQL
Twilio API / twilio-ruby gem
Javascript, jQuery, AJAX
HTML 5 / CSS 3
Bootstrap
Handlebars
This app is a work in progress! The job handler that will send messages to users once per day is still being worked on, so don't expect your reminder message just yet.
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /sign-up |
users#signup |
POST | /sign-in |
users#signin |
DELETE | /sign-out/:id |
users#signout |
PATCH | /change-password |
users#changepw |
GET | /contacts |
contacts#index |
POST | /contacts |
contacts#create |
GET | /contacts/:id |
contacts#show |
PATCH | /contacts/:id |
contacts#update |
Delete | /contacts/:id/ |
contacts#destroy |
All data returned from API actions is formatted as JSON.
Summary:
Request | Response | |||
---|---|---|---|---|
Verb | URI | body | Status | body |
POST | `/sign-up` | credentials | 201, Created | user |
400 Bad Request | empty | |||
POST | `/sign-in` | credentials | 200 OK | user w/token |
401 Unauthorized | empty | |||
DELETE | `/sign-out/:id` | empty | 201 Created | empty |
401 Unauthorized | empty | |||
PATCH | `/change-password/:id` | passwords | 204 No Content | user w/token |
400 Bad Request | empty |
The create
action expects a POST of credentials
identifying a new user to create, e.g. using FormData
:
<form>
<input name="credentials[email]" type="text" value="an@example.email">
<input name="credentials[password]" type="password" value="an example password">
<input name="credentials[password_confirmation]" type="password" value="an example password">
</form>
or using JSON
:
{
"credentials": {
"email": "an@example.email",
"password": "an example password",
"password_confirmation": "an example password"
}
}
The password_confirmation
field is optional.
If the request is successful, the response will have an HTTP Status of 201, Created, and the body will be JSON containing the id
and email
of the new user, e.g.:
{
"user": {
"id": 1,
"email": "an@example.email"
}
}
If the request is unsuccessful, the response will have an HTTP Status of 400 Bad Request, and the response body will be empty.
The signin
action expects a POST with credentials
identifying a previously registered user, e.g.:
<form>
<input name="credentials[email]" type="text" value="an@example.email">
<input name="credentials[password]" type="password" value="an example password">
</form>
or:
{
"credentials": {
"email": "an@example.email",
"password": "an example password"
}
}
If the request is successful, the response will have an HTTP Status of 200, OK, and the body will be JSON containing the user's id
, email
, and the token
used to authenticate other requests, e.g.:
{
"user": {
"id": 1,
"email": "an@example.email",
"token": "an example authentication token"
}
}
If the request is unsuccessful, the response will have an HTTP Status of 401 Unauthorized, and the response body will be empty.
The signout
actions is a DELETE specifying the id
of the user so sign out.
If the request is successful the response will have an HTTP status of 204 No Content.
If the request is unsuccessful, the response will have a status of 401 Unauthorized.
The changepw
action expects a PATCH of passwords
specifying the old
and new
.
If the request is successful the response will have an HTTP status of 204 No Content.
If the request is unsuccessful the reponse will have an HTTP status of 400 Bad Request.
The sign-out
and change-password
requests must include a valid HTTP header Authorization: Token token=<token>
or they will be rejected with a status of 401 Unauthorized.
All contact action requests must include a valid HTTP header Authorization: Token token=<token>
or they will be rejected with a status of 401 Unauthorized.
Summary:
Request | Response | |||
---|---|---|---|---|
Verb | URI | body | Status | body |
GET | `/contacts` | n/a | 200, OK | contact found |
200, OK | empty | |||
The default is to retrieve all games associated with the user.. | 401 Unauthorized | empty | ||
POST | `/contacts` | n/a | 201, Created | contact created |
401 Unauthorized | empty | |||
400 Bad Request | errors | |||
PATCH | `/contacts/:id` | empty | 200, OK | contact created |
400 Bad Request | errors | |||
400 Bad Request | empty |
The index
action is a GET that retrieves all the contacts associated with a user. The response body will contain JSON containing an array of contacts, e.g.:
{
"contacts": [
{
"id": 1,
"first_name": "Kitty",
"last_name": "Holmes",
"occupation": "Professor",
"professional_relationship": "Mentor",
"company": "BU",
"last_contacted": "20120407",
"fact": "Likes Pizza"
,
"id": 2,
"first_name": "John",
"last_name": "Holmes",
"occupation": "Professor",
"professional_relationship": "Mentor",
"company": "BC",
"last_contacted": "20120407",
"fact": "Likes Pizza"
}
]
}
If there are no contacts associated with the user, the response body will contain an empty contacts array, e.g.:
{
"contacts": [
]
}
The create
action expects a POST with an empty body (e.g new FormData()
or ''
- if JSON, '{}'
). If the request is successful, the response will have an HTTP Status of 201, Created, and the body will contain JSON of the created contact e.g:
"contact": {
"first_name": "Rob",
"last_name": "Smith",
"occupation": "Scientist",
"professional_relationship": "Former Boss",
"company": "BU",
"last_contacted": "20130407",
"fact": "Likes Hiking"
}
}'
If the request is unsuccessful, the response will have an HTTP Status of 400 Bad Request, and the response body will be JSON describing the errors.