Module: Goodreads::Books

Included in:
Client
Defined in:
lib/goodreads/client/books.rb

Instance Method Summary collapse

Instance Method Details

#book(id) ⇒ Object

Get book details by Goodreads book ID



19
20
21
# File 'lib/goodreads/client/books.rb', line 19

def book(id)
  Hashie::Mash.new(request('/book/show', :id => id)['book'])
end

#book_by_isbn(isbn) ⇒ Object

Get book details by book ISBN



25
26
27
# File 'lib/goodreads/client/books.rb', line 25

def book_by_isbn(isbn)
  Hashie::Mash.new(request('/book/isbn', :isbn => isbn)['book'])
end

#book_by_title(title) ⇒ Object

Get book details by book title



31
32
33
# File 'lib/goodreads/client/books.rb', line 31

def book_by_title(title)
  Hashie::Mash.new(request('/book/title', :title => title)['book'])
end

#search_books(query, params = {}) ⇒ Object

Search for books

query - Text to match against book title, author, and ISBN fields. options - Optional search parameters

options - Which page to returns (default: 1) options - Search field. One of: title, author, or genre (default is all)



11
12
13
14
15
# File 'lib/goodreads/client/books.rb', line 11

def search_books(query, params={})
  params[:q] = query.to_s.strip
  data = request('/search/index', params)
  Hashie::Mash.new(data['search'])
end