Module: SeeClickFix::Configuration

Included in:
SeeClickFix
Defined in:
lib/seeclickfix/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
:adapter,
:api_key,
:api_version,
:login,
:password,
:proxy,
:token,
:oauth_token,
:user_agent].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_API_KEY =
nil
DEFAULT_API_VERSION =
nil
DEFAULT_LOGIN =
nil
DEFAULT_PASSWORD =
nil
DEFAULT_PROXY =
nil
DEFAULT_TOKEN =
nil
DEFAULT_OAUTH_TOKEN =
nil
DEFAULT_USER_AGENT =
"SeeClickFix Ruby Gem #{SeeClickFix::VERSION}".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



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

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



33
34
35
# File 'lib/seeclickfix/configuration.rb', line 33

def configure
  yield self
end

#optionsObject



37
38
39
# File 'lib/seeclickfix/configuration.rb', line 37

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

#resetObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/seeclickfix/configuration.rb', line 41

def reset
  self.adapter     = DEFAULT_ADAPTER
  self.api_key     = DEFAULT_API_KEY
  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