Module: Goodreads

Defined in:
lib/goodreads.rb,
lib/goodreads/client.rb,
lib/goodreads/errors.rb,
lib/goodreads/request.rb,
lib/goodreads/version.rb,
lib/goodreads/client/books.rb,
lib/goodreads/client/users.rb,
lib/goodreads/client/groups.rb,
lib/goodreads/client/authors.rb,
lib/goodreads/client/friends.rb,
lib/goodreads/client/reviews.rb,
lib/goodreads/client/shelves.rb,
lib/goodreads/client/authorized.rb

Defined Under Namespace

Modules: Authorized, Authors, Books, Friends, Groups, Request, Reviews, Shelves, Users Classes: Client, ConfigurationError, Error, NotFound, Unauthorized

Constant Summary collapse

VERSION =
'0.2.2'.freeze
@@options =
{}

Class Method Summary collapse

Class Method Details

.configurationObject

Returns global configuration hash



32
33
34
# File 'lib/goodreads.rb', line 32

def self.configuration
  @@options
end

.configure(options = {}) ⇒ Object

Define a global configuration

options - Account API key options - Account API secret



20
21
22
23
24
25
26
27
28
# File 'lib/goodreads.rb', line 20

def self.configure(options={})
  unless options.kind_of?(Hash)
    raise ArgumentError, "Options hash required."
  end
  
  @@options[:api_key]    = options[:api_key]
  @@options[:api_secret] = options[:api_secret]
  @@options
end

.new(options = {}) ⇒ Object

Create a new Goodreads::Client instance



11
12
13
# File 'lib/goodreads.rb', line 11

def self.new(options={})
  Goodreads::Client.new(options)
end

.reset_configurationObject

Resets the global configuration



38
39
40
# File 'lib/goodreads.rb', line 38

def self.reset_configuration
  @@options = {}
end