Class: GoogleBooks::Item
- Inherits:
-
Object
- Object
- GoogleBooks::Item
- Defined in:
- lib/book/item.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
-
#authors_array ⇒ Object
readonly
Returns the value of attribute authors_array.
-
#average_rating ⇒ Object
readonly
Returns the value of attribute average_rating.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#info_link ⇒ Object
readonly
Returns the value of attribute info_link.
-
#isbn ⇒ Object
readonly
Returns the value of attribute isbn.
-
#isbn_10 ⇒ Object
readonly
Returns the value of attribute isbn_10.
-
#isbn_13 ⇒ Object
readonly
Returns the value of attribute isbn_13.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#other_identifier ⇒ Object
readonly
Returns the value of attribute other_identifier.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#preview_link ⇒ Object
readonly
Returns the value of attribute preview_link.
-
#print_type ⇒ Object
readonly
Returns the value of attribute print_type.
-
#published_date ⇒ Object
readonly
Returns the value of attribute published_date.
-
#publisher ⇒ Object
readonly
Returns the value of attribute publisher.
-
#ratings_count ⇒ Object
readonly
Returns the value of attribute ratings_count.
-
#sale_info ⇒ Object
readonly
Returns the value of attribute sale_info.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#titles_array ⇒ Object
readonly
Returns the value of attribute titles_array.
Instance Method Summary collapse
-
#image_link(opts = {}) ⇒ Object
Enables image_link attribute to be customized via passing optional zoom and edge arguments as a hash.
-
#initialize(item) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(item) ⇒ Item
Returns a new instance of Item.
6 7 8 9 10 |
# File 'lib/book/item.rb', line 6 def initialize(item) @item = item @volume_info = @item['volumeInfo'] retrieve_attribute end |
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
4 5 6 |
# File 'lib/book/item.rb', line 4 def @authors end |
#authors_array ⇒ Object (readonly)
Returns the value of attribute authors_array.
4 5 6 |
# File 'lib/book/item.rb', line 4 def @authors_array end |
#average_rating ⇒ Object (readonly)
Returns the value of attribute average_rating.
4 5 6 |
# File 'lib/book/item.rb', line 4 def @average_rating end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
4 5 6 |
# File 'lib/book/item.rb', line 4 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/book/item.rb', line 4 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/book/item.rb', line 4 def id @id end |
#info_link ⇒ Object (readonly)
Returns the value of attribute info_link.
4 5 6 |
# File 'lib/book/item.rb', line 4 def info_link @info_link end |
#isbn ⇒ Object (readonly)
Returns the value of attribute isbn.
4 5 6 |
# File 'lib/book/item.rb', line 4 def isbn @isbn end |
#isbn_10 ⇒ Object (readonly)
Returns the value of attribute isbn_10.
4 5 6 |
# File 'lib/book/item.rb', line 4 def isbn_10 @isbn_10 end |
#isbn_13 ⇒ Object (readonly)
Returns the value of attribute isbn_13.
4 5 6 |
# File 'lib/book/item.rb', line 4 def isbn_13 @isbn_13 end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
4 5 6 |
# File 'lib/book/item.rb', line 4 def kind @kind end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
4 5 6 |
# File 'lib/book/item.rb', line 4 def language @language end |
#other_identifier ⇒ Object (readonly)
Returns the value of attribute other_identifier.
4 5 6 |
# File 'lib/book/item.rb', line 4 def other_identifier @other_identifier end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
4 5 6 |
# File 'lib/book/item.rb', line 4 def page_count @page_count end |
#preview_link ⇒ Object (readonly)
Returns the value of attribute preview_link.
4 5 6 |
# File 'lib/book/item.rb', line 4 def preview_link @preview_link end |
#print_type ⇒ Object (readonly)
Returns the value of attribute print_type.
4 5 6 |
# File 'lib/book/item.rb', line 4 def print_type @print_type end |
#published_date ⇒ Object (readonly)
Returns the value of attribute published_date.
4 5 6 |
# File 'lib/book/item.rb', line 4 def published_date @published_date end |
#publisher ⇒ Object (readonly)
Returns the value of attribute publisher.
4 5 6 |
# File 'lib/book/item.rb', line 4 def publisher @publisher end |
#ratings_count ⇒ Object (readonly)
Returns the value of attribute ratings_count.
4 5 6 |
# File 'lib/book/item.rb', line 4 def @ratings_count end |
#sale_info ⇒ Object (readonly)
Returns the value of attribute sale_info.
4 5 6 |
# File 'lib/book/item.rb', line 4 def sale_info @sale_info end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/book/item.rb', line 4 def title @title end |
#titles_array ⇒ Object (readonly)
Returns the value of attribute titles_array.
4 5 6 |
# File 'lib/book/item.rb', line 4 def titles_array @titles_array end |
Instance Method Details
#image_link(opts = {}) ⇒ Object
Enables image_link attribute to be customized via passing optional zoom and edge arguments as a hash
14 15 16 17 18 |
# File 'lib/book/item.rb', line 14 def image_link(opts = {}) opts[:zoom] ||= 1 opts[:curl] ||= false @volume_info['imageLinks']['thumbnail'].gsub('zoom=1', "zoom=#{opts[:zoom]}").gsub('&edge=curl', "&edge=#{opts[:curl] ? 'curl' : 'none'}") rescue nil end |