Module: Goodreads::Authors

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

Instance Method Summary collapse

Instance Method Details

#author(id, params = {}) ⇒ Object

Get author details



5
6
7
8
9
# File 'lib/goodreads/client/authors.rb', line 5

def author(id, params = {})
  params[:id] = id
  data = request("/author/show", params)
  Hashie::Mash.new(data["author"])
end

#author_by_name(name, params = {}) ⇒ Object

Search for an author by name



13
14
15
16
17
18
# File 'lib/goodreads/client/authors.rb', line 13

def author_by_name(name, params = {})
  params[:id] = name
  name_encoded = URI.encode(name)
  data = request("/api/author_url/#{name_encoded}", params)
  Hashie::Mash.new(data["author"])
end