pawanpoudel/location_tester_user_service — pull request #2 by pawanpoudel (2013-10-04 02:26:09+00:00)
Title: Implement an endpoint for creating a user

This PR allows client code to create a user by POSTing valid data. Listed below are HTTP request and response body.

Valid POST request
-----------------------------
~~~shell
curl -X POST -H "Content-Type: application/json" -d '{"name":"walter","email":"walter_sobchak@example.com","password":"shabbos","bio":"verteran"}' http://localhost:9393/api/v1/users
~~~

~~~json
{
"id": 17,
"name": "walter",
"email": "walter_sobchak@example.com",
"bio": "verteran",
"created_at": "2013-10-04T02:17:16Z",
"updated_at": "2013-10-04T02:17:16Z"
}
~~~

Invalid POST request
------------------------------
~~~shell
curl -X POST -H "Content-Type: application/json" -d '{"invalid_key":"invalid_value"}' http://localhost:9393/api/v1/users
~~~

~~~json
{
"error": "unknown attribute: invalid_key"
}
~~~