Class: Google::Book::Response

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/google/book/response.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Response

Returns a new instance of Response.



8
9
10
# File 'lib/google/book/response.rb', line 8

def initialize(hash)
  @feed = hash['feed']
end

Instance Method Details

#each(&block) ⇒ Object



12
13
14
15
16
# File 'lib/google/book/response.rb', line 12

def each(&block)
  members.each do |member|
    block.call(Entry.new(member))
  end
end

#total_resultsObject



18
19
20
# File 'lib/google/book/response.rb', line 18

def total_results
  @feed['openSearch:totalResults'].to_i
end