Module: Uatu::Configuration

Included in:
Uatu
Defined in:
lib/uatu/configuration.rb

Constant Summary collapse

VALID_CONFIG_KEYS =
[:base_url, :public_key, :private_key]
BASE_URL =
"http://gateway.marvel.com"
PUBLIC_KEY =
PRIVATE_KEY =

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



12
13
14
# File 'lib/uatu/configuration.rb', line 12

def self.extended(base)
  base.reset
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



16
17
18
# File 'lib/uatu/configuration.rb', line 16

def configure
  yield self
end

#optionsObject



20
21
22
# File 'lib/uatu/configuration.rb', line 20

def options
  Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
end

#resetObject



24
25
26
27
28
# File 'lib/uatu/configuration.rb', line 24

def reset
  self.base_url     = BASE_URL
  self.public_key   = PUBLIC_KEY
  self.private_key  = PRIVATE_KEY
end