Class: Google::Books::Items
- Inherits:
-
Object
- Object
- Google::Books::Items
- Defined in:
- lib/bookle/google_books_items.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#total_items ⇒ Object
readonly
Returns the value of attribute total_items.
Instance Method Summary collapse
-
#initialize(google_response) ⇒ Items
constructor
A new instance of Items.
Constructor Details
#initialize(google_response) ⇒ Items
Returns a new instance of Items.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bookle/google_books_items.rb', line 9 def initialize(google_response) books_info = JSON.parse(google_response) @kind = books_info["kind"] @total_items = books_info["totalItems"] || 0 if books_info["items"] @items = books_info["items"].collect {|item| Google::Books::Item.new(item)} else @items = [] end end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
7 8 9 |
# File 'lib/bookle/google_books_items.rb', line 7 def items @items end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
7 8 9 |
# File 'lib/bookle/google_books_items.rb', line 7 def kind @kind end |
#total_items ⇒ Object (readonly)
Returns the value of attribute total_items.
7 8 9 |
# File 'lib/bookle/google_books_items.rb', line 7 def total_items @total_items end |