Class: Aide::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/aide/config.rb

Constant Summary collapse

ADDRESS_KEY =
'.Address'.freeze
ADDRESS_METHOD =
:Address
SERVICE_ADDRESS_KEY =
'.ServiceAddress'.freeze
SERVICE_ADDRESS_METHOD =
:ServiceAddress

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



12
13
14
15
16
# File 'lib/aide/config.rb', line 12

def initialize
  @services = {}
  @service_address_key = ADDRESS_KEY
  @service_address_method = ADDRESS_METHOD
end

Instance Attribute Details

#service_address_keyObject

Returns the value of attribute service_address_key.



3
4
5
# File 'lib/aide/config.rb', line 3

def service_address_key
  @service_address_key
end

#service_address_methodObject

Returns the value of attribute service_address_method.



3
4
5
# File 'lib/aide/config.rb', line 3

def service_address_method
  @service_address_method
end

#servicesObject

Returns the value of attribute services.



3
4
5
# File 'lib/aide/config.rb', line 3

def services
  @services
end

Instance Method Details

#add_service(name:, url: nil, auth: nil, user_key: nil, password_key: nil, protocol_key: nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/aide/config.rb', line 28

def add_service(name:, url:nil, auth:nil, user_key:nil, password_key:nil, protocol_key:nil)
  services[name] = {
    name: name,
    url: url,
    auth: auth,
    user_key: user_key,
    password_key: password_key,
    protocol_key: protocol_key
  }
end

#get_service(name:) ⇒ Object



39
40
41
# File 'lib/aide/config.rb', line 39

def get_service(name:)
  services[name] || {}
end

#use_address!Object



18
19
20
21
# File 'lib/aide/config.rb', line 18

def use_address!
  self.service_address_key = ADDRESS_KEY
  self.service_address_method = ADDRESS_METHOD
end

#use_service_address!Object



23
24
25
26
# File 'lib/aide/config.rb', line 23

def use_service_address!
  self.service_address_key = SERVICE_ADDRESS_KEY
  self.service_address_method = SERVICE_ADDRESS_METHOD
end