Instructions to test
# Create users
curl -X POST -d “user=Ivanov&user=123qwe” micro-chat-api.herokuapp.com/users.json
{“id”:1,“name”:“Ivanov”,“messages_count”:0,“auth_token”:“7b9ce33f-164f-4500-a46e-6c80907a7383”,“created_at”:“2016-05-27T09:11:31.773Z”}
curl -X POST -d “user=Petrov&user=123qwe” micro-chat-api.herokuapp.com/users.json
{“id”:2,“name”:“Petrov”,“messages_count”:0,“auth_token”:“e11c9d99-c7f9-4e92-8cd5-0bccaea792e5”,“created_at”:“2016-05-27T09:13:10.165Z”}
# Login
curl -X POST -d “user=Ivanov&user=123qwe” micro-chat-api.herokuapp.com/sessions.json
# Get users list
curl -X GET -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/users.json
# View chats
curl -X GET -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats.json
# Create chat
curl -X POST -d “chat=Zimbabwe&chat[]=1&chat[]=2” -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats.json
# Post message to chat
curl -X POST -d “message=Zimbabwe” -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats/1/messages.json
# Read chat messages
curl -X GET -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats/1/messages.json
# Get unread messages
curl -X GET -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats/1/unread_messages.json
# Mark unread messages read
curl -X DELETE -H “Authorization: Token token=7b9ce33f-164f-4500-a46e-6c80907a7383” micro-chat-api.herokuapp.com/chats/1/unread_messages.json