Skip to content

rajcybage/google_book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<title>Google Book API Integration for all </title>
Google_book

Google Book Api Integration For Books and Magazines and Book Shelves


Google Book API integration for fetching the information for google books and magazines and book shelves also filter them. You can eaisly get most of the elements for a particular book and magazine or the books of a book shelf from the google book search. like :-(title,sub title,preview link,authors,publisher,publish date,buylink,downloadlink,version,ISBN information,ratings,...many more..Also you can get the google checkout link for that book/magazine

Installation

In Gemfile
gem 'google_book'

System Requirements

Ruby >= 1.9.3 or jruby >=1.7.x rails >= 3.0.x

Usage

b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
b.search("Name of the book you want to search",type) #type should be a number

  • type = 1 ===> intitle: Returns results where the text following this keyword is found in the title.
  • type = 2 ===> inauthor: Returns results where the text following this keyword is found in the author.
  • type = 3 ====> inpublisher: Returns results where the text following this keyword is found in the publisher.
  • type = 4 ===> subject: Returns results where the text following this keyword is listed in the category list of the volume.
  • type = 5 ====>isbn: Returns results where the text following this keyword is the ISBN number.
  • ltype = 6 ====> ccn: Returns results where the text following this keyword is the Library of Congress Control Number.
  • type = 7 ===> oclc: Returns results where the text following this keyword is the Online Computer Library Center number.
  • type = 8 ===> Returns the book which can be downloadable

b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
b.search("keyword or book name",1)
b.book_info.get_all_subtitles # to get all the subtitles of your search book b.total_count #get the search results count

If you want to access each and every book as an instance of book

you can then create a instance of books which was getting by search by following ways

b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
b.search("Name of the book you want to search",1)
b.books #create the instance of all the books of your search
b.books.first.get_title #get the first book title
b.books.first.get_sub_title#get the first book sub title
b.books.first.authors #get the first book authors
b.books.first.text_snippet_description #get the first book text snippet description
b.books.first.publish_date #get the first book published date
b.books.first.publisher #get the first book publisher name
b.books.first.rating #get the rating of the book
b.books.first.total_rating #get the total rating count of the book
b.books.first.version #get the version of the book
b.books.first.preview_link #get the first book preview link
b.books.first.info_link #get the first book information
b.price #get the book price with currency
b.books.first.thumbnail_image #get the first book thumbnail image
b.books.first.small_thumbnail_link #get the first book thumbnail image

If you want to access google checkout for a particular book we can get the link for checkout

b.books.first.google_checkout_link #get the first book direct google checkout

Want ISBN Information


b.books.first.ISBN_info #isbn info for first book it will return hash like {:ISBN_10 => "778545"}

Want to search Downloadable Books

b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
b.search('downloadable book name',8) b.books.first.downloadable?#check whther the book is downloadable
b.books.first.buyable?#check whether the book is buyable
b.books.first.buy_link
b.books.first.download_link

Want to get Magazines only

b=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
b.search('downloadable book name',9) #type is 9 for only magazines b.books #create the magaize instances
b.books.first.magazine?
so on..now get all the info(title,subtitle,author,preview....) of each and every magazine instanaces as stated above

Filter your Search

  • filter_type = 1 free-ebooks - Only returns results that are free Google eBooks.
  • filter_type = 2 paid-ebooks - Only returns results that are Google eBooks with a price.
  • filter_type = 3 full - Only returns results where all of the text is viewable.
  • filter_type = 4 ebooks - Only returns results that are Google eBooks, paid or free. Examples of non-eBooks would be publisher content that is available in limited preview and not for sale, or magazines.
filter_book=GoogleBook::Book.new(:api_key => "YOUR_GOOOGLE_API_KEY")
filter_book.filter('ruby language', 1)#here one is filter_type as defined above
Now create all books instance as usual
filter_book.books If you select your filter as free ebook then it will be downloadable and buyable
<code>filter_book.books.first.downloadable?#check whther the book is downloadable</code><br/>
<code>filter_book.books.first.buyable?#check whether the book is buyable</code><br/>
<code>filter_book.books.first.buy_link</code><br/>
<code>filter_book.books.first.download_link</code>

If You want to get the book shelves of a particular user

bs=BookShelves.new("GOGLE_BOOKS_USER_ID")
bs.bookshelves #all the book shelves of that user in a instance
bs.bookshelves.first.title #the title of the books shelve first
bs.bookshelves.first.self_link #the title of the books shelve first

If you want the books of a particular Book shelves

bs.bookshelves.first.books#get all the books of that book shelves
bs.bookshelves.first.books.first.get_title
Now you can access all the methods of those books(ex:-get_title,preview_link....etc)

Contributing

Fork it

Create your feature branch (git checkout -b my-new-feature)

Commit your changes (git commit -am 'Add some feature')

Push to the branch (git push origin my-new-feature)

Create new Pull Request