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,
:oauth_token,
:user_agent,
:version].freeze
VALID_FORMATS =
[
:json,
:xml,
:yaml].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_ENDPOINT =
'https://github.com/'.freeze
DEFAULT_FORMAT =
:json
DEFAULT_LOGIN =
nil
DEFAULT_PASSWORD =
nil
DEFAULT_PROXY =
nil
DEFAULT_TOKEN =
nil
DEFAULT_OAUTH_TOKEN =
nil
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



36
37
38
# File 'lib/octokit/configuration.rb', line 36

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



40
41
42
# File 'lib/octokit/configuration.rb', line 40

def configure
  yield self
end

#optionsObject



44
45
46
# File 'lib/octokit/configuration.rb', line 44

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

#resetObject



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/octokit/configuration.rb', line 48

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.oauth_token = DEFAULT_OAUTH_TOKEN
  self.user_agent  = DEFAULT_USER_AGENT
  self.version     = DEFAULT_VERSION
end