class Goodreads::Client

Attributes

api_key[R]
api_secret[R]
oauth_token[R]

Public Class Methods

new(options = {}) click to toggle source

Initialize a Goodreads::Client instance

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

# File lib/goodreads/client.rb, line 31
def initialize(options = {})
  fail(ArgumentError, "Options hash required.") unless options.is_a?(Hash)

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

Public Instance Methods

oauth_configured?() click to toggle source

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

# File lib/goodreads/client.rb, line 44
def oauth_configured?
  !oauth_token.nil?
end