Module: Octokit::Configuration

Included in:
Octokit
Defined in:
lib/octokit/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[:adapter, :endpoint, :format, :login, :password, :proxy, :token, :user_agent, :version].freeze
VALID_FORMATS =
[:json, :xml, :yaml].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter.freeze
DEFAULT_ENDPOINT =
'https://github.com/'.freeze
DEFAULT_FORMAT =
:json.freeze
DEFAULT_LOGIN =
nil.freeze
DEFAULT_PASSWORD =
nil.freeze
DEFAULT_PROXY =
nil.freeze
DEFAULT_TOKEN =
nil.freeze
DEFAULT_USER_AGENT =
"Octokit Ruby Gem #{Octokit::VERSION}".freeze
DEFAULT_VERSION =
2

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



21
22
23
# File 'lib/octokit/configuration.rb', line 21

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/octokit/configuration.rb', line 25

def configure
  yield self
end

#optionsObject



29
30
31
# File 'lib/octokit/configuration.rb', line 29

def options
  VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) }
end

#resetObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/octokit/configuration.rb', line 33

def reset
  self.adapter    = DEFAULT_ADAPTER
  self.endpoint   = DEFAULT_ENDPOINT
  self.format     = DEFAULT_FORMAT
  self.      = DEFAULT_LOGIN
  self.password   = DEFAULT_PASSWORD
  self.proxy      = DEFAULT_PROXY
  self.token      = DEFAULT_TOKEN
  self.user_agent = DEFAULT_USER_AGENT
  self.version    = DEFAULT_VERSION
end