Class: Google::Search::Item::Book

Inherits:
Google::Search::Item show all
Defined in:
lib/google-search/item/book.rb

Instance Attribute Summary collapse

Attributes inherited from Google::Search::Item

#content, #index, #thumbnail_height, #thumbnail_uri, #thumbnail_width, #title, #uri, #visible_uri

Instance Method Summary collapse

Methods inherited from Google::Search::Item

class_for

Constructor Details

#initialize(hash) ⇒ Book

Initialize with hash.



30
31
32
33
34
35
36
# File 'lib/google-search/item/book.rb', line 30

def initialize hash
  super
  @author = hash['authors']
  @published_year = hash['publishedYear'].to_i
  @id = hash['bookId']
  @pages = hash['pageCount'].to_i
end

Instance Attribute Details

#authorObject (readonly)

Author name(s).



15
16
17
# File 'lib/google-search/item/book.rb', line 15

def author
  @author
end

#idObject (readonly)

Book id.



10
11
12
# File 'lib/google-search/item/book.rb', line 10

def id
  @id
end

#pagesObject (readonly)

Page count.



25
26
27
# File 'lib/google-search/item/book.rb', line 25

def pages
  @pages
end

#published_yearObject (readonly)

Published year.



20
21
22
# File 'lib/google-search/item/book.rb', line 20

def published_year
  @published_year
end