Class: Acapela::Config
- Inherits:
-
Object
- Object
- Acapela::Config
- Defined in:
- lib/acapela/config.rb
Constant Summary collapse
- DEFAULT_PROTOCOL =
'2'
- DEFAULT_VERSION =
'1-30'
- DEFAULT_TARGET_URL =
'http://vaas.acapela-group.com/Services/Synthesizer'
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#target_url ⇒ Object
readonly
Returns the value of attribute target_url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(login, application, password, target_url = nil, version = nil, protocol = nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(login, application, password, target_url = nil, version = nil, protocol = nil) ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 23 24 25 |
# File 'lib/acapela/config.rb', line 18 def initialize(login, application, password, target_url = nil, version = nil, protocol = nil) @login = login @application = application @password = password @protocol = protocol || DEFAULT_PROTOCOL @version = version || DEFAULT_VERSION @target_url = URI.parse(target_url || DEFAULT_TARGET_URL) end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def application @application end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def environment @environment end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def login @login end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def password @password end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def protocol @protocol end |
#target_url ⇒ Object (readonly)
Returns the value of attribute target_url.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def target_url @target_url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/acapela/config.rb', line 6 def version @version end |
Class Method Details
.read(config_file = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/acapela/config.rb', line 27 def self.read(config_file = nil) config_file ||= File.join('config', 'acapela.yml') begin yaml = YAML.load_file(config_file) self.new(yaml['login'], yaml['application'], yaml['password'], yaml['target_url'] , yaml['version'], yaml['protocol']) rescue => err raise Error.new("Failed to read configuration file", err) end end |