module Octokit

Ruby toolkit for the GitHub API

Adapted from lostisland/faraday_middleware. Trimmed down to just the logic that we need for octokit.rb.

github.com/lostisland/faraday_middleware/blob/138766e/lib/faraday_middleware/response/follow_redirects.rb

Constants

MAJOR

Current major release. @return [Integer]

MINOR

Current minor release. @return [Integer]

PATCH

Current patch level. @return [Integer]

VERSION

Full release version. @return [String]

Public Class Methods

client() click to toggle source

API client based on configured options {Configurable}

@return [Octokit::Client] API wrapper

# File lib/octokit.rb, line 15
def client
  return @client if defined?(@client) && @client.same_options?(options)
  @client = Octokit::Client.new(options)
end
enterprise_admin_client() click to toggle source

EnterpriseAdminClient client based on configured options {Configurable}

@return [Octokit::EnterpriseAdminClient] API wrapper

# File lib/octokit.rb, line 23
def enterprise_admin_client
  return @enterprise_admin_client if defined?(@enterprise_admin_client) && @enterprise_admin_client.same_options?(options)
  @enterprise_admin_client = Octokit::EnterpriseAdminClient.new(options)
end
enterprise_management_console_client() click to toggle source

EnterpriseManagementConsoleClient client based on configured options {Configurable}

@return [Octokit::EnterpriseManagementConsoleClient] API wrapper

# File lib/octokit.rb, line 31
def enterprise_management_console_client
  return @enterprise_management_console_client if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options)
  @enterprise_management_console_client = Octokit::EnterpriseManagementConsoleClient.new(options)
end

Private Class Methods

method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/octokit.rb, line 44
def method_missing(method_name, *args, &block)
  if client.respond_to?(method_name)
    return client.send(method_name, *args, &block)
  elsif enterprise_admin_client.respond_to?(method_name)
    return enterprise_admin_client.send(method_name, *args, &block)
  elsif enterprise_management_console_client.respond_to?(method_name)
    return enterprise_management_console_client.send(method_name, *args, &block)
  end

  super
end
respond_to_missing?(method_name, include_private=false) click to toggle source
# File lib/octokit.rb, line 38
def respond_to_missing?(method_name, include_private=false)
  client.respond_to?(method_name, include_private) ||
  enterprise_admin_client.respond_to?(method_name, include_private) ||
  enterprise_management_console_client.respond_to?(method_name, include_private)
end