Class: Goodreads::Client
- Inherits:
-
Object
- Object
- Goodreads::Client
- Defined in:
- lib/goodreads/client.rb
Constant Summary
Constants included from Request
Request::API_FORMAT, Request::API_URL
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#oauth_token ⇒ Object
readonly
Returns the value of attribute oauth_token.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
Initialize a Goodreads::Client instance.
-
#oauth_configured? ⇒ Boolean
Return if this client is configured with OAuth credentials for a single user.
Methods included from Friends
Methods included from Groups
Methods included from Authorized
Methods included from Shelves
#add_to_shelf, #shelf, #shelves
Methods included from Users
Methods included from Authors
Methods included from Reviews
#create_review, #edit_review, #recent_reviews, #review, #reviews, #user_review
Methods included from Books
#book, #book_by_isbn, #book_by_title, #search_books
Constructor Details
#initialize(options = {}) ⇒ Client
31 32 33 34 35 36 37 |
# File 'lib/goodreads/client.rb', line 31 def initialize( = {}) fail(ArgumentError, "Options hash required.") unless .is_a?(Hash) @api_key = [:api_key] || Goodreads.configuration[:api_key] @api_secret = [:api_secret] || Goodreads.configuration[:api_secret] @oauth_token = [:oauth_token] end |
Instance Attribute Details
#api_key ⇒ Object (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_secret ⇒ Object (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_token ⇒ Object (readonly)
Returns the value of attribute oauth_token.
23 24 25 |
# File 'lib/goodreads/client.rb', line 23 def oauth_token @oauth_token end |
Instance Method Details
#oauth_configured? ⇒ Boolean
Return if this client is configured with OAuth credentials for a single user
False when client is instantiated with an api_key and secret, true when client is instantiated with an oauth_token
44 45 46 |
# File 'lib/goodreads/client.rb', line 44 def oauth_configured? !oauth_token.nil? end |