Module: Inthegra::Configuration

Included in:
Inthegra
Defined in:
lib/inthegra/configuration.rb

Constant Summary collapse

VALID_OPTIONS =

Default options of the configuration module

[
  :email,
  :password,
  :api_key,
  :auth_token,
  :proxy,

  :user_agent,
  :endpoint
]
DEFAULT_ENDPOINT =
'https://api.inthegra.strans.teresina.pi.gov.br/v1'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

Set default value when this methods is extented



21
22
23
# File 'lib/inthegra/configuration.rb', line 21

def self.extended(base)
  base.set_default_values
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



25
26
27
# File 'lib/inthegra/configuration.rb', line 25

def configure
  yield self
end

#optionsObject

Return the array of options



34
35
36
37
38
# File 'lib/inthegra/configuration.rb', line 34

def options
  VALID_OPTIONS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end

#set_default_valuesObject



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

def set_default_values
  self.endpoint = DEFAULT_ENDPOINT
end