Class: Google::Books::Items

Inherits:
Object
  • Object
show all
Defined in:
lib/bookle/google_books_items.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#itemsObject (readonly)

Returns the value of attribute items.



7
8
9
# File 'lib/bookle/google_books_items.rb', line 7

def items
  @items
end

#kindObject (readonly)

Returns the value of attribute kind.



7
8
9
# File 'lib/bookle/google_books_items.rb', line 7

def kind
  @kind
end

#total_itemsObject (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