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.1"
Class Method Summary collapse
-
.client(options = {}) ⇒ Object
A global instance of the Client class.
- .discard_client! ⇒ Object
- .log ⇒ Object
-
.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’).
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( = {}) @client ||= Octoplex::Client.new() end |
.discard_client! ⇒ Object
20 21 22 |
# File 'lib/octoplex.rb', line 20 def discard_client! @client = nil end |
.log ⇒ Object
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 |