Skip to content

Instantly share code, notes, and snippets.

@jagira
Last active December 15, 2015 14:39
Show Gist options
  • Save jagira/5276405 to your computer and use it in GitHub Desktop.
Save jagira/5276405 to your computer and use it in GitHub Desktop.
A small coding assignment to test developer's basic Ruby (and Sinatra/Rails) skills
* Write a small web service (using Sinatra, Padrino, Rails or Rack if you are adventurous) that fetches and returns 10 (or any user specified number) latest tweets for the specified username.
* Architect the app according to your own taste.
* Rough specs
- It should have only one controller endpoint. For example,
'/tweets'
- The endpoint should accept a twitter username and tweet count (default set to 10). For example,
'/tweets?username=google&count=20
- The endpoint should return the following data in json format
----------------------------------------------------------------------------------------
| Tweet ID | Tweet Text | Number of words in tweet | Whether the tweet contains a link |
----------------------------------------------------------------------------------------
e.g [{id: 12345, tweet_text: "This is a tweet, yo!", word_count: 5, link_present: false}, ....]
- The endpoint should raise proper exceptions (for errors at your end and at Twitter's end)
* There is no need to use any Twitter API libraries. Nor do you need to store the tweet data. Just fetch it everytime a person queries the endpoint.
* Use this endpoint of Twitter's API - https://dev.twitter.com/docs/api/1/get/statuses/user_timeline (Checkout example request section. You can test that endpoint in browser as well)
* In code comments, justify the placement of code that fetches tweets from Twitter. For example, if you handle that functionality within the same controller endpoint action, then justify your reasons. Or if you write a separate class for it, then justify reasons for that. We just want to know how you think while designing the app architecture.
* [Optional] - Deploy it to Heroku (not sure whether they offer free plans anymore) or any other server/platform if you can. [Note: Engineyard offers 500 hours for free. Try it out if you want to. Should be a good deploying experience.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment