Skip to content

Instantly share code, notes, and snippets.

@timoteoponce
Last active December 18, 2017 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timoteoponce/9ce5eb85e55af3649a5460c4df75c8e6 to your computer and use it in GitHub Desktop.
Save timoteoponce/9ce5eb85e55af3649a5460c4df75c8e6 to your computer and use it in GitHub Desktop.
EXERCISE: Messaging service-sinatra.md

Exercise: Messages list service

This exercise consists on creating a REST service that allows external applications to create and manage message lists, basically there are two contexts:

  • User management: Services that allow the register, update or removal of users
  • Messages management: Services that allow message exchange between registered users

So the service will allow users to be registered, send messages between them and retrieve all the messages directed to a specific user.

Example

User Roberto gets registered and wants to send a messages to user Marines (which is already registered), he then sends a message to the service and the message gets queued into Marines' messages list. Marines then can get the her list of messages and reply to Roberto using the same service Roberto used in first place.

  1. Register Roberto: POST http://host/user/roberto
  2. Send message to Marines: POST http://host/message/roberto/marines?msg="Hola Marines"
  3. Marines gets her message list: GET http://host/message/marines
  4. Marines replies to Roberto: POST http://host/message/marines/roberto?msg="Como anda ese camba?"
  5. Roberto gets his message list: GET http://host/message/roberto

Constraints

  • Only registered users can send and receive messages
  • JSON must be used as communication protocol
  • Users and messages must be stored in the server (file storage, database, etc.)
  • Messages must store the sent and seen dates
  • Ruby(language) and Sinatra(framework) must be used

Deliverables

  • The project must be send as a ZIP file or as a public repository (github, bitbucket)
  • The project must include a README.md file that describes how to make it run and how to test it, example: https://github.com/chkal/todo-mvc
  • Additional points are given if you provide a UI for the project (HTML)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment