Sha256: de13243c3a30fdfcac4359935d9c290bb7e2cac80b2bb72e85ba1e3febbd6e86

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

require File.expand_path('../octokit/configuration', __FILE__)
require File.expand_path('../octokit/client', __FILE__)

module Octokit
  extend Configuration

  # Alias for Octokit::Client.new
  #
  # @return [Octokit::Client]
  def self.client(options={})
    Octokit::Client.new(options)
  end

  # Delegate to Octokit::Client.new
  def self.method_missing(method, *args, &block)
    return super unless client.respond_to?(method)
    client.send(method, *args, &block)
  end

  # Custom error class for rescuing from all GitHub errors
  class Error < StandardError; end

  # Raised when GitHub returns a 400 HTTP status code
  class BadRequest < Error; end

  # Raised when GitHub returns a 401 HTTP status code
  class Unauthorized < Error; end

  # Raised when GitHub returns a 403 HTTP status code
  class Forbidden < Error; end

  # Raised when GitHub returns a 404 HTTP status code
  class NotFound < Error; end

  # Raised when GitHub returns a 406 HTTP status code
  class NotAcceptable < Error; end

  # Raised when GitHub returns a 500 HTTP status code
  class InternalServerError < Error; end

  # Raised when GitHub returns a 501 HTTP status code
  class NotImplemented < Error; end

  # Raised when GitHub returns a 502 HTTP status code
  class BadGateway < Error; end

  # Raised when GitHub returns a 503 HTTP status code
  class ServiceUnavailable < Error; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
octokit-0.5.2 lib/octokit.rb
octokit-0.5.1 lib/octokit.rb
octokit-0.5.0 lib/octokit.rb
octokit-0.4.1 lib/octokit.rb
octokit-0.4.0 lib/octokit.rb