-
Notifications
You must be signed in to change notification settings - Fork 4
Home
This week you'll write a command line program to interact with Twitter. In the process, you'll learn:
- The difference between data and information
- How data is transmitted on the web
- How to use a web api that requires a application context for authentication
- How to use a web api that requires a user context authentication
Your mission is to build a command line ruby program that allows a user to perform the following tasks:
- See any users timeline --
./twitter timeline zspencer
- See any users information (Join date, location, etc.) --
./twitter info jfarmer
- See any users followers --
./twitter followers <yourhandle>
- See who is following any user --
./twitter following <yourhandle>
- Send a tweet --
./twitter tweet I know kung fu
- Send a DM --
./twitter message zspencer do you know kung fu?
- Follow a user --
./twitter follow jfarmer
- Unfollow a user --
./twitter unfollow zspencer
We've provided a very tiny skeleton of a command line application
- Fork this repository and Clone to your machine
- CD into this directory
- Run
bundle install
- Create your Application in Twitters Dev Center
- Create a
.env
file and place your Twitter credentials in it. - 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
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
- ???