Sha256: adfee79bffc7f514c38a8c9dbf1e0f74e588c641868555fe58d43eb9df425dd3

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require "goodreads/client"
require "goodreads/client/books"
require "goodreads/client/reviews"
require "goodreads/client/authors"
require "goodreads/client/users"
require "goodreads/client/shelves"
require "goodreads/client/authorized"
require "goodreads/client/groups"
require "goodreads/client/friends"

module Goodreads
  class Client
    include Goodreads::Request
    include Goodreads::Books
    include Goodreads::Reviews
    include Goodreads::Authors
    include Goodreads::Users
    include Goodreads::Shelves
    include Goodreads::Authorized
    include Goodreads::Groups
    include Goodreads::Friends

    attr_reader :api_key, :api_secret, :oauth_token

    # Initialize a Goodreads::Client instance
    #
    # options[:api_key]     - Account API key
    # options[:api_secret]  - Account API secret
    # options[:oauth_token] - OAuth access token (optional, required for some calls)
    #
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
goodreads-0.6.1 lib/goodreads/client.rb
goodreads-0.6.0 lib/goodreads/client.rb
goodreads-0.5.0 lib/goodreads/client.rb