Class: Aide::Config
- Inherits:
-
Object
- Object
- Aide::Config
- 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
-
#service_address_key ⇒ Object
Returns the value of attribute service_address_key.
-
#service_address_method ⇒ Object
Returns the value of attribute service_address_method.
-
#services ⇒ Object
Returns the value of attribute services.
Instance Method Summary collapse
- #add_service(name:, url: nil, auth: nil, user_key: nil, password_key: nil, protocol_key: nil) ⇒ Object
- #get_service(name:) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #use_address! ⇒ Object
- #use_service_address! ⇒ Object
Constructor Details
#initialize ⇒ Config
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_key ⇒ Object
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_method ⇒ Object
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 |
#services ⇒ Object
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 |