Classy Coding

My Journey to Code

Leave a comment

How to Use an API with Ruby

This past week I learned how to use an API with Ruby! It is amazingly easy so here are the steps.

Step 1.

Go to  or to search for the API. Both sources are reliable and have an extensive collection with documentation. Searching for your gem is so easy!

Step 2.

For ruby-toolbox, this is how your screen will look. This gives you information regarding the gem version, release date, bug tracker, pretty much all the info you could possibly want. Then it gives you the github link as well as the rdoc link.


Step 3.

When you click on the Rubygem, you be taken to this page This gives you instructions on installing the gem. Pretty easy so far!

Step 4.

The documentation link (this link appears on both screens at step 2 and 3) re-directs you to the rdoc page that explains in detail the functions available to you with this gem.

This includes further installation instructions:


a quick start guide (with a link to registering your application so you don’t have to search around for that!):


….and the best part gives you usage examples that are INCREDIBLY helpful. This allows you to see all the methods available to you while using this gem. Pretty awesome!


Step 5.

After installing the gem, registering your application with Twitter, finish configuring with the authentication codes you received during registration. Follow the configuration format provided in the quickstart section listed previously. Don’t forget to require your gem in your ruby document.

Step 6.

That’s it! You are set up with the Twitter API gem. This instructions can easily work with any API you are hoping to use in your ruby code.