Simple ruby webservice that does TODOs!
- Create a new TODO item for a given user
- With a due date
- Mark a TODO item complete
- Retrieve the completed TODO items for a given user
- Retrieve the incomplete TODO items for a given user
- Persist all data through a later determined method
- Requests and responses as JSON
bundle exec rackup
It will report which localhost port it's listening on
Request:
POST localhost:9292/todos/2
Headers:
Content-Type application/json
Body:
{
"due_date": "2015-07-13T01:09:58-05:00",
"note": "This is my test todo to see that it works!"
}
Response:
{
"id": 5,
"user_id": 2,
"created_at": "2015-07-10T01:46:22-05:00",
"due_date": "2015-07-13T01:09:58-05:00",
"note": "This is my test todo to see that it works!",
"completed": false
}
Request:
PUT localhost:9292/todos/6/complete
Response:
{
"id": 6,
"user_id": 2,
"created_at": "2015-07-10T01:47:20-05:00",
"due_date": "2015-07-13T01:09:58-05:00",
"note": "This is another test todo because it works!",
"completed": true
}
Request:
GET localhost:9292/todos/2/completed
Response:
[
{
"id": 6,
"user_id": 2,
"created_at": "2015-07-10T01:47:20-05:00",
"due_date": "2015-07-13T01:09:58-05:00",
"note": "This is another test todo because it works!",
"completed": true
}
]
Request:
GET localhost:9292/todos/2/uncompleted
Response:
[
{
"id": 5,
"user_id": 2,
"created_at": "2015-07-10T01:46:22-05:00",
"due_date": "2015-07-13T01:09:58-05:00",
"note": "This is my test todo to see that it works!",
"completed": false
}
]