Module: Octoplex

Defined in:
lib/octoplex.rb,
lib/octoplex/client.rb,
lib/octoplex/errors.rb,
lib/octoplex/version.rb,
lib/octoplex/connection.rb,
lib/octoplex/client/base.rb,
lib/octoplex/client/root.rb,
lib/octoplex/client/user.rb,
lib/octoplex/client/repository.rb

Defined Under Namespace

Classes: BadGateway, BadRequest, Client, Connection, Error, Forbidden, InternalServerError, NotAcceptable, NotFound, NotImplemented, ServiceUnavailable, Unauthorized, UnprocessableEntity

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.client(options = {}) ⇒ Object

A global instance of the Client class

Options:

:token - The OAuth token you have retrieved earlier.


16
17
18
# File 'lib/octoplex.rb', line 16

def client(options = {})
  @client ||= Octoplex::Client.new(options)
end

.discard_client!Object



20
21
22
# File 'lib/octoplex.rb', line 20

def discard_client!
  @client = nil
end

.logObject



25
26
27
28
29
30
31
# File 'lib/octoplex.rb', line 25

def log
  @log ||= begin
    log = Logger.new($stdout)
    log.level = Logger::INFO
    log
  end
end

.method_missing(meth, *args, &blk) ⇒ Object

Delegate missing API calls to client, so we can do things like: Octoplex.users(‘octocat’) Octoplex.user Octoplex.repos(‘octocat’)



37
38
39
40
41
42
43
# File 'lib/octoplex.rb', line 37

def method_missing(meth, *args, &blk)
  if client.respond_to?(meth)
    client.send(meth, *args, &blk)
  else
    super
  end
end