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
authors() click to toggle source

the authors(s) of the book

# File lib/google_book/book_item.rb, line 21
def authors
  @item[:item]["volumeInfo"]["authors"]
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
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
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
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
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
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