Class: Clearbooks::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/clearbooks/library/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/clearbooks/library/configuration.rb', line 20

def initialize
  defaults  =   YAML.load_file('config/clearbooks.yml') rescue nil
  defaults  ||= YAML.load_file(DEFAULT_CONFIG) rescue nil
  defaults  ||= YAML.load_file(File.expand_path("~/#{DEFAULT_CONFIG}")) rescue Hash.new

  @api_key = ENV['CLEARBOOKS_API_KEY'] || defaults['api_key']
  @wsdl = defaults['wsdl'] || 'https://secure.clearbooks.co.uk/api/wsdl/'
  @log = defaults['log'] || false
  @logger = Logger.new(STDOUT)
  @log_level = defaults['log_level'].andand.to_sym || :info
  self
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



16
17
18
# File 'lib/clearbooks/library/configuration.rb', line 16

def api_key
  @api_key
end

#logObject

Returns the value of attribute log.



16
17
18
# File 'lib/clearbooks/library/configuration.rb', line 16

def log
  @log
end

#log_levelObject

Returns the value of attribute log_level.



16
17
18
# File 'lib/clearbooks/library/configuration.rb', line 16

def log_level
  @log_level
end

#loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/clearbooks/library/configuration.rb', line 16

def logger
  @logger
end

#wsdlObject

Returns the value of attribute wsdl.



16
17
18
# File 'lib/clearbooks/library/configuration.rb', line 16

def wsdl
  @wsdl
end