How to create a gem for working with an API

Illustration of a construction barrier with orange and white stripes, a pile of dirt with a shovel, and an outline of a construction crane in the background. Illustration of a construction barrier with orange and white stripes, a pile of dirt with a shovel, and an outline of a construction crane in the background.

I may (or may not) reveal a little secret to you: not all gems are available on http://rubygems.org. A lot of gems are internal company products, they solve one specific for the company problem and are never put into a public repository. That's why a lot of developers have written through their career a bunch of libraries, which have never been brought to the judgment of an open source community due to the narrowness of their usage and the lack of resources for their further development.

Such internal gems can be spread via their gem server or using a service like gemfury.

But sometimes there are problems which other developers can be faced with. In this case it makes sense either to start the development in a public repository or open the source code closer to the 1.0 version. The most popular of these cases: a client library for working with some service API.

In this series of articles I am going to write a gem for working with the GrooveHQ service API, the library itself will be available on GitHub and rubygems, and I hope that other developers working with this service will use it. Here, on mkdev, we used to use GrooveHQ to respond to resumes of those who need a free consultation of an experienced developer.

I confess: this will be my first open source gem. I will create it in front of your eyes. You can even make pull requests to it and improve my code (actually, I hope very much that you will). Consider this as a developer diary (hello, video games lovers), but targeted on you learning new things.

By the end of the series you will learn how to create gems from the ground up, I will solve my problem (we on mkdev really need such a library), and companies using GrooveHQ and ruby will be able to use this gem for their own purposes. Let's go!