module Github

First saw on octokit, then copied from lostisland/faraday_middleware and adapted for this library.

faraday_middleware/lib/faraday_middleware/response/follow_redirects.rb

Constants

DEPRECATION_PREFIX
LIBDIR
LIBNAME
VERSION

Attributes

deprecation_tracker[W]

Public Class Methods

config()
Alias for: configuration
configuration() click to toggle source

The client configuration

@return [Configuration]

@api public

# File lib/github_api.rb, line 19
def configuration
  @configuration ||= Configuration.new
end
Also aliased as: config
configure() { |configuration| ... } click to toggle source

Configure options

@example

Github.configure do |c|
  c.some_option = true
end

@yield the configuration block @yieldparam configuration [Github::Configuration]

the configuration instance

@return [nil]

@api public

# File lib/github_api.rb, line 38
def configure
  yield configuration
end
default_middleware(options = {}) click to toggle source

Default middleware stack that uses default adapter as specified by configuration setup

@return [Proc]

@api private

# File lib/github_api.rb, line 60
def default_middleware(options = {})
  Middleware.default(options)
end
deprecate(method, alternate_method=nil) click to toggle source

Displays deprecation message to the user. Each message is printed once.

# File lib/github_api/deprecation.rb, line 17
    def deprecate(method, alternate_method=nil)
      return if deprecation_tracker.include? method
      deprecation_tracker << method

      message = <<-NOTICE
#{DEPRECATION_PREFIX}

* #{method} is deprecated.
NOTICE
      if alternate_method
        message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
      end
      warn_deprecation(message)
    end
deprecation_tracker() click to toggle source
# File lib/github_api/deprecation.rb, line 11
def deprecation_tracker
  @deprecation_tracker ||= []
end
method_missing(method_name, *args, &block) click to toggle source

Delegate to Github::Client

@api private

Calls superclass method
# File lib/github_api.rb, line 67
def method_missing(method_name, *args, &block)
  if new.respond_to?(method_name)
    new.send(method_name, *args, &block)
  elsif configuration.respond_to?(method_name)
    Github.configuration.send(method_name, *args, &block)
  else
    super
  end
end
new(options = {}, &block) click to toggle source

Alias for Github::Client.new

@param [Hash] options

the configuration options

@return [Github::Client]

@api public

# File lib/github_api.rb, line 50
def new(options = {}, &block)
  Client.new(options, &block)
end
respond_to?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/github_api.rb, line 77
def respond_to?(method_name, include_private = false)
  new.respond_to?(method_name, include_private) ||
  configuration.respond_to?(method_name) ||
  super(method_name, include_private)
end
warn_deprecation(message) click to toggle source
# File lib/github_api/deprecation.rb, line 34
def warn_deprecation(message)
  send :warn, message
end