Class: Clearbooks::Configuration
- Inherits:
-
Object
- Object
- Clearbooks::Configuration
- Defined in:
- lib/clearbooks/library/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#log ⇒ Object
Returns the value of attribute log.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#wsdl ⇒ Object
Returns the value of attribute wsdl.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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.("~/#{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_key ⇒ Object
Returns the value of attribute api_key.
16 17 18 |
# File 'lib/clearbooks/library/configuration.rb', line 16 def api_key @api_key end |
#log ⇒ Object
Returns the value of attribute log.
16 17 18 |
# File 'lib/clearbooks/library/configuration.rb', line 16 def log @log end |
#log_level ⇒ Object
Returns the value of attribute log_level.
16 17 18 |
# File 'lib/clearbooks/library/configuration.rb', line 16 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
16 17 18 |
# File 'lib/clearbooks/library/configuration.rb', line 16 def logger @logger end |
#wsdl ⇒ Object
Returns the value of attribute wsdl.
16 17 18 |
# File 'lib/clearbooks/library/configuration.rb', line 16 def wsdl @wsdl end |