Introducing a Ruby Wrapper for Google Books API

August 10, 2011 • Damien White

Books.  Personally, I own a ton of them.  Add in my wife’s collection, and phew.  A few years ago, I decided to get my collection under control.  I have bookcases upon bookcases all over the place and I would lose track of my books.  I wanted to catalog my collection, so I built a site to do just that.

The time has come to rebuild the project.  It’s pretty old, is missing a lot of features, has spun off into another site as well, and, and, and…  That’s for another post.  Anyway, back to the matter at hand.

For the past couple of years, I used to get my book information from Amazon’s Product Advertising API for Affiliates. Well, times change, and thanks to the State of Connecticut, I’m no longer an Amazon affiliate.  I told you that story to tell you this one…

New Options

Whilst Amazon hasn’t kicked me out yet, since I was redesigning my sites (Rails 3.1 Engines FTW), I decided to look for other APIs.  My search led me to the Google Books API.  I really liked it.  So, off I went to look for a Ruby wrapper around the API.  I found Hakan Ensari’s google-book gem (source hosted on GitHub, of course).  Cool, but after reading the README, I realized his wrapper worked against the Google Book Search Data API. This turns out to be a deprecated API “Important: The Google GData Books API is deprecated as of May 26, 2011 and will be fully retired on December 1, 2011. Therefore, we encourage you to move to the new Books API.”  Hmm, so what’s a guy to do?

Introducing google_books

I initially started with a fork of the google-book project on GitHub, but came to the conclusion that a whole lot had changed in the new API.  I eventually decided to create a new gem called google_books.  The project is greatly inspired by Hakan’s gem.  The google_books gem has similar syntax to Hakan’s, and in places I followed his lead.

The gem is really straight-forward to use.  It is in its infancy, but I will be adding to project as I work on rebuilding my sites.  Check out the README for usage and examples.  There are also a few examples in the project itself that you can play with.  Let me know what you think.  Fork the project; add cool stuff.  Open source projects are so rewarding, especially in the Ruby community.

Posted in google_books, ruby, ruby on rails and tagged with Ruby, google_books

Damien White

I am a software architect with over 16 years of experience. I simply love coding! I have a driving passion for computers and software development, and a thirst for knowledge that just cannot be quenched. I'm happy to share what I know in my quest to learn as much as possible. I focus most of my time on web development using Ruby on Rails, Ember.js, and ASP.NET MVC.

comments powered by Disqus