Module: Recalls::Configuration

Included in:
Recalls
Defined in:
lib/recalls/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
:adapter,
:endpoint,
:user_agent,
:api_key,
:proxy,
:format].freeze
VALID_FORMATS =
[:json].freeze
DEFAULT_ADAPTER =
Faraday.default_adapter
DEFAULT_ENDPOINT =
nil
DEFAULT_PROXY =
nil
DEFAULT_FORMAT =
:json
DEFAULT_API_KEY =
nil.freeze
DEFAULT_USER_AGENT =
"Recalls Recalls Ruby Gem #{Recalls::VERSION}".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



24
25
26
# File 'lib/recalls/configuration.rb', line 24

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



28
29
30
# File 'lib/recalls/configuration.rb', line 28

def configure
  yield self
end

#optionsObject



32
33
34
# File 'lib/recalls/configuration.rb', line 32

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

#resetObject



36
37
38
39
40
41
42
43
# File 'lib/recalls/configuration.rb', line 36

def reset
  self.adapter      = DEFAULT_ADAPTER
  self.user_agent   = DEFAULT_USER_AGENT
  self.endpoint     = DEFAULT_ENDPOINT
  self.format       = DEFAULT_FORMAT
  self.proxy        = DEFAULT_FORMAT
  self.api_key      = DEFAULT_API_KEY      
end