visoft/google_books — pull request #3 by madwork (2014-07-23 09:06:35+00:00)
Title: Implement API.find method to find a book by its unique VolumeID

I implement a find to query the Google Books API to find a book by its unique VolumeID. This method use the book's selfLink, like this one: https://www.googleapis.com/books/v1/volumes/Q9liB1DQR2MC, to get an API::Book instance.

I also use the HTTParty powerful API (compatible with HTTParty >= 0.8.1) to simplify the get request and to add errors handling. It's also possible to remove the query private method, because HTTParty knows how to handle string or hash of parameters:
https://github.com/jnunemaker/httparty/blob/257f7fd2fc75db431e3cd87af460f9b161de9bf0/lib/httparty.rb#L50

I also use autoload to avoid require unused class/module, per example, if you are only using the API.find method, the API::Response will not be loaded.

Sorry for the unneeded deletions, my editor trims trailing white space by default.