class BookItem
Attributes
item[R]
Public Class Methods
new(item)
click to toggle source
# File lib/google_book/book_item.rb, line 6 def initialize(item) @item = item end
Public Instance Methods
ISBN_info()
click to toggle source
ISBN information for the book
# File lib/google_book/book_item.rb, line 91 def ISBN_info isbn_info = @item[:item]["volumeInfo"]["industryIdentifiers"].inject({}) do |result, isbn| result[isbn["type"]] = isbn["identifier"] result end isbn_info end
buy_link()
click to toggle source
the buy link of the book
# File lib/google_book/book_item.rb, line 116 def buy_link if buyable? @item[:item]["saleInfo"]["buyLink"] else "your book is not buyable" end end
buyable?()
click to toggle source
check whether the book is buy able or not
# File lib/google_book/book_item.rb, line 148 def buyable? if @item[:item]["saleInfo"]["isEbook"] != true || @item[:item]["saleInfo"]["buyLink"].nil? false else true end end
canonical_volume_link()
click to toggle source
canonical volume link
# File lib/google_book/book_item.rb, line 46 def canonical_volume_link @item[:item]["volumeInfo"]["canonicalVolumeLink"] end
categories()
click to toggle source
The categories of the book
# File lib/google_book/book_item.rb, line 31 def categories @item[:item]["volumeInfo"]["categories"] end
download_link()
click to toggle source
the download link of the book
# File lib/google_book/book_item.rb, line 157 def download_link if downloadable? @item[:item]["accessInfo"]["pdf"]["downloadLink"] else "your book is not downloadable" end end
downloadable?()
click to toggle source
check whether the book is download able or not
# File lib/google_book/book_item.rb, line 139 def downloadable? unless @item[:item]["accessInfo"]["pdf"].nil? || @item[:item]["accessInfo"]["pdf"]["downloadLink"].nil? true else false end end
get_sub_title()
click to toggle source
get the sub title of the book
# File lib/google_book/book_item.rb, line 16 def get_sub_title @item[:item]["volumeInfo"]["subtitle"] end
get_title()
click to toggle source
get the title of the book
# File lib/google_book/book_item.rb, line 11 def get_title @item[:item]["volumeInfo"]["title"] end
google_checkout_link()
click to toggle source
checkout link
# File lib/google_book/book_item.rb, line 76 def google_checkout_link "https://play.google.com/store/books/details?id=#{@item[:item]["id"]}&rdid=book-#{@item[:item]["id"]}&rdot=1&source=gbs_atb" end
info_link()
click to toggle source
Information link
# File lib/google_book/book_item.rb, line 41 def info_link @item[:item]["volumeInfo"]["infoLink"] end
magazine?()
click to toggle source
check whether it is magazine or not
# File lib/google_book/book_item.rb, line 125 def magazine? if @item[:item]["volumeInfo"]["printType"].upcase == "MAGAZINE" true else false end end
pagecount()
click to toggle source
total pages
# File lib/google_book/book_item.rb, line 61 def pagecount @item[:item]["volumeInfo"]["pageCount"] end
preview_link()
click to toggle source
The preview link
# File lib/google_book/book_item.rb, line 36 def preview_link @item[:item]["volumeInfo"]["previewLink"] end
price()
click to toggle source
The price of the book
# File lib/google_book/book_item.rb, line 134 def price @item[:item]["saleInfo"]["listPrice"]["amount"].to_s + ' ' + @item[:item]["saleInfo"]["listPrice"]["currencyCode"] unless @item[:item]["saleInfo"]["listPrice"].nil? end
publish_date()
click to toggle source
The published date of the book
# File lib/google_book/book_item.rb, line 26 def publish_date @item[:item]["volumeInfo"]["publishedDate"] end
publisher()
click to toggle source
publisher
# File lib/google_book/book_item.rb, line 105 def publisher @item[:item]["volumeInfo"]["publisher"] end
rating()
click to toggle source
The rating of the book
# File lib/google_book/book_item.rb, line 81 def rating @item[:item]["volumeInfo"]["averageRating"] end
small_thumbnail_link()
click to toggle source
small thumbnail images
# File lib/google_book/book_item.rb, line 56 def small_thumbnail_link @item[:item]["volumeInfo"]["imageLinks"]["smallThumbnail"] end
text_snippet_description()
click to toggle source
text snippet description
# File lib/google_book/book_item.rb, line 71 def text_snippet_description @item[:item]["searchInfo"]["textSnippet"] unless @item[:item]["searchInfo"].nil? end
thubnail_image()
click to toggle source
thumbnail images
# File lib/google_book/book_item.rb, line 51 def thubnail_image @item[:item]["volumeInfo"]["imageLinks"]["thumbnail"] end
total_rating()
click to toggle source
the total count of the rating
# File lib/google_book/book_item.rb, line 100 def total_rating @item[:item]["volumeInfo"]["ratingsCount"] end
version()
click to toggle source
The version of the book
# File lib/google_book/book_item.rb, line 86 def version @item[:item]["volumeInfo"]["contentVersion"] end
web_reader_link()
click to toggle source
web reader link
# File lib/google_book/book_item.rb, line 66 def web_reader_link @item[:item]["accessInfo"]["webReaderLink"] end