Class: Readmill::Client

Inherits:
Object
  • Object
show all
Includes:
Books, ClosingRemarks, Comments, Highlights, Locations, Periods, Readings, Search, Users, Request
Defined in:
lib/readmill/client.rb,
lib/readmill/client/books.rb,
lib/readmill/client/users.rb,
lib/readmill/client/search.rb,
lib/readmill/client/periods.rb,
lib/readmill/client/comments.rb,
lib/readmill/client/readings.rb,
lib/readmill/client/locations.rb,
lib/readmill/client/highlights.rb,
lib/readmill/client/closing_remarks.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, ClosingRemarks, Comments, Highlights, Locations, Periods, Readings, Search, Users

Instance Method Summary collapse

Methods included from Users

#user

Methods included from Search

#search

Methods included from Readings

#reading, #readings

Methods included from Periods

#periods

Methods included from Locations

#locations

Methods included from Highlights

#highlight, #highlights

Methods included from Comments

#comment, #comments

Methods included from ClosingRemarks

#closing_remark

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: {}).



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/readmill/client.rb', line 25

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.



40
41
42
# File 'lib/readmill/client.rb', line 40

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