Class: Acapela::Config

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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(, application, password, target_url = nil, version = nil, protocol = nil)
  @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

#applicationObject (readonly)

Returns the value of attribute application.



6
7
8
# File 'lib/acapela/config.rb', line 6

def application
  @application
end

#environmentObject (readonly)

Returns the value of attribute environment.



6
7
8
# File 'lib/acapela/config.rb', line 6

def environment
  @environment
end

#loginObject (readonly)

Returns the value of attribute login.



6
7
8
# File 'lib/acapela/config.rb', line 6

def 
  @login
end

#passwordObject (readonly)

Returns the value of attribute password.



6
7
8
# File 'lib/acapela/config.rb', line 6

def password
  @password
end

#protocolObject (readonly)

Returns the value of attribute protocol.



6
7
8
# File 'lib/acapela/config.rb', line 6

def protocol
  @protocol
end

#target_urlObject (readonly)

Returns the value of attribute target_url.



6
7
8
# File 'lib/acapela/config.rb', line 6

def target_url
  @target_url
end

#versionObject (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