Class: Goodreads::Client

Inherits:
Object
  • Object
show all
Includes:
Authorized, Authors, Books, Friends, Groups, Request, Reviews, Shelves, Users
Defined in:
lib/goodreads/client.rb

Constant Summary

Constants included from Request

Request::API_FORMAT, Request::API_URL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Friends

#friends

Methods included from Groups

#group, #group_list

Methods included from Authorized

#user_id

Methods included from Shelves

#shelf

Methods included from Users

#user

Methods included from Authors

#author, #author_by_name

Methods included from Reviews

#recent_reviews, #review, #reviews

Methods included from Books

#book, #book_by_isbn, #book_by_title, #search_books

Constructor Details

#initialize(options = {}) ⇒ Client

Initialize a Goodreads::Client instance

options - Account API key options - Account API secret options - OAuth access token (optional, required for some calls)



31
32
33
34
35
36
37
38
39
# File 'lib/goodreads/client.rb', line 31

def initialize(options={})
  unless options.kind_of?(Hash)
    raise ArgumentError, "Options hash required."
  end

  @api_key    = options[:api_key] || Goodreads.configuration[:api_key]
  @api_secret = options[:api_secret] || Goodreads.configuration[:api_secret]
  @oauth_token = options[:oauth_token]
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



23
24
25
# File 'lib/goodreads/client.rb', line 23

def api_key
  @api_key
end

#api_secretObject (readonly)

Returns the value of attribute api_secret.



23
24
25
# File 'lib/goodreads/client.rb', line 23

def api_secret
  @api_secret
end

#oauth_tokenObject (readonly)

Returns the value of attribute oauth_token.



23
24
25
# File 'lib/goodreads/client.rb', line 23

def oauth_token
  @oauth_token
end