Skip to content
Jesse Farmer edited this page Jun 23, 2014 · 3 revisions

Twitter Client

This week you'll write a command line program to interact with Twitter. In the process, you'll learn:

  1. The difference between data and information
  2. How data is transmitted on the web
  3. How to use a web api that requires a application context for authentication
  4. How to use a web api that requires a user context authentication

Your Mission

Your mission is to build a command line ruby program that allows a user to perform the following tasks:

  1. See any users timeline -- ./twitter timeline zspencer
  2. See any users information (Join date, location, etc.) -- ./twitter info jfarmer
  3. See any users followers -- ./twitter followers <yourhandle>
  4. See who is following any user -- ./twitter following <yourhandle>
  5. Send a tweet -- ./twitter tweet I know kung fu
  6. Send a DM -- ./twitter message zspencer do you know kung fu?
  7. Follow a user -- ./twitter follow jfarmer
  8. Unfollow a user -- ./twitter unfollow zspencer

Getting Started

We've provided a very tiny skeleton of a command line application

  1. Fork this repository and Clone to your machine
  2. CD into this directory
  3. Run bundle install
  4. Create your Application in Twitters Dev Center
  5. Create a .env file and place your Twitter credentials in it.
  6. run ./twitter

If you're confused about the .env file, see https://github.com/codeunion/dotenv-example. The dotenv gem is used to manage sensitive information like the Twitter credentials that we'll need to make a Twitter application. You might be tempted to just include this information right in your code, but remember that anyone who can see your code would then be able to see your Twitter credentials!

You can copy the .env.example file to .env to see what format the .env file needs to be in, like so:

cp .env.example .env

Helpful Resources

  1. How The Internet Works
  2. Working with Twitter
  3. Glossary of Terms

Bored?

Did you rush through this without breaking a sweat? Here's some additional challenges:

  • Publish this as a gem! - Perhaps load the users credentials from a file in their home directory
  • Make a Text Messaging app off the Twilio API
  • ???
Clone this wiki locally