Class: Readmill::Client

Inherits:
Object
  • Object
show all
Includes:
Books, Request
Defined in:
lib/readmill/client.rb,
lib/readmill/client/books.rb

Overview

Public: The Client is what wraps all of the Readmill API. You will use this class to handle the majority of your interaction with Readmill.

Defined Under Namespace

Modules: Books

Instance Method Summary collapse

Methods included from Books

#book, #books

Methods included from Request

#get

Constructor Details

#initialize(opts = {}) ⇒ Client

Public: Constructor for a Readmill::Client.

opts - A Hash of options to modify the client (default: {}).



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/readmill/client.rb', line 17

def initialize(opts={})

  # TODO: Extract this, move it elsewhere. If this hasn't been configured,
  # I'm wondering if we raise an exception and move on?
  Readmill.configuration ||= Readmill::Configuration.new

  config = Readmill.configuration.values.merge(opts)
  Readmill::Configuration::VALID_CONFIGURATION_KEYS.each do |k|
    send("#{k}=", config[k])
  end
end

Instance Method Details

#api_urlObject

Public: Get the base URL for accessing the Readmill API.

Returns a String.



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

def api_url
  "https://api.readmill.com/v2/"
end