0.01
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper that allows you to query the Google Books API. This project was inspired by google-book, see the README for more information
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 4.4.6
>= 0.8.7
~> 2.6.0
~> 1.11.3
~> 1.7.6

Runtime

>= 1.1.0
>= 0.8.1
 Project Readme

Google Books

Google Books is a Ruby wrapper to the Google Books API The project was inspired by google-book. It is a nice wrapper, however the Google Book Search Data API "is deprecated as of May 26, 2011 and will be fully retired on December 1, 2011."

Usage

The usage is similar to that of google-book, but the semantics are a little different

require 'google_books' # Or hey, add it to your Gemfile

books = GoogleBooks::API.search('Douglas Crockford')
book = books.first
puts book.title
#=> "JavaScript: The Good Parts"
puts book.isbn
#=> "9780596517748"
puts book.covers[:thumbnail]
#=> "http://bks8.books.google.com/books?id=..."

In addition to the query, the GoogleBooks::API.search method takes in a hash of 3 different options:

  • count: The number of results that you want returned, currently the default is 10 (set by Google)
  • page: The page of results that you want. Combine this with total_results method of the GoogleBooks::API::Response, and implement paging in your application
  • api_key: For production apps, Google requires either OAuth 2.0 or an API key to request public data. See the API Documentation for more information.

Queries

Within your query that you pass to the search method, you can use special keywords as outlined in the API Documentation

  • intitle: Returns results where the text following this keyword is found in the title.
  • inauthor: Returns results where the text following this keyword is found in the author.
  • inpublisher: Returns results where the text following this keyword is found in the publisher.
  • subject: Returns results where the text following this keyword is listed in the category list of the volume.
  • isbn: Returns results where the text following this keyword is the ISBN number.

For example:

# Get the book with the isbn of 9781118035580
books = GoogleBooks::API.search('isbn:9781118035580')
book = books.first

puts book.title
#=> "Hands - on ASP.NET AJAX Control Toolkit"
puts book.authors.first
#=> "Damien White" (Shameless plug)
puts book.covers[:thumbnail]
#=> "http://bks7.books.google.com/books?id=..."

Book Attributes

  • title: String

    This will append a subtitle if one exists, like "JavaScript: The Good Parts"

  • authors: Array

  • publisher: String

  • published_date: String

    The published_date is represented by the format YYYY-MM-DD with MM and DD being optional

  • isbn: String

  • isbn_10: String

  • page_count: FixNum

  • categories: Array

  • description: String

  • average_rating: Float

  • ratings_count: FixNum

  • covers: Hash

    The keys are :thumbnail, :small, :medium, :large, :extra_large

    Not all of the image URLs are guaranteed to return something. Stick with thumbnail or small for the best results

  • preview_link: String

  • info_link: String