Module: Octokit::Configuration

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

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
:adapter,
:api_version,
:login,
:password,
:proxy,
:token,
:oauth_token,
:user_agent].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_API_VERSION =
2
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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



27
28
29
# File 'lib/octokit/configuration.rb', line 27

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



31
32
33
# File 'lib/octokit/configuration.rb', line 31

def configure
  yield self
end

#optionsObject



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

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

#resetObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/octokit/configuration.rb', line 39

def reset
  self.adapter     = DEFAULT_ADAPTER
  self.api_version = DEFAULT_API_VERSION
  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
end