Class: Liberic::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/liberic/config.rb

Overview

Provides an interface to ERiC’s configuration parameters and logging.

Scope

This class is not meant to be instantiated directly. An instance is created the first time it is accessed in the Liberic namespace.

Liberic.config # will return an instance of Config

Configuration parameters

Configuration parameters can be accessed with the hash notation. Keys are passed to ERiC directly, so they must be in German (see ERiC documentation for this).

Example:

Liberic.config['validieren.fehler_max'] # 30

Config provides an english abstraction to these parameters with attr_accessor like getter/setter methods:

Liberic.config.validation_error_limit = 30

The most common settings are (german names in paranthesis)

  • data_path (basis.data_dir) directory to store PDFs and certificates in

  • allow_test_id (basis.test_id_erlaubt) allow fake tax ids when processing tax filings

  • detailed_logs (log.detailed) set log level to debug. Also disables rolling logs (if detailed_logs is false, ERiC will create a maximum of ten log files on disk, each with 1 MB of size. The oldest file will be deleted when rolling over). WARNING: Logging to disk is disabled after instantiating Config. See :logger: for details.

  • validation_error_limit (validieren.fehler_max) limits the amount of errors that are returned when processing or checking tax filings. This means even though 50 fields inside the tax report are missing, only the first 30 are reported as part of the response.

  • online (transfer.netz.doi) allow connecting to the actual tax authority’s production systems.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



38
39
40
# File 'lib/liberic/config.rb', line 38

def initialize
  install_logger
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



36
37
38
# File 'lib/liberic/config.rb', line 36

def logger
  @logger
end

Instance Method Details

#[](key) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/liberic/config.rb', line 95

def [](key)
  convert_to_ruby(
    Helpers::Invocation.with_result_buffer do |handle|
      SDK::API.einstellung_lesen(key, handle)
    end
  )
end

#[]=(key, value) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/liberic/config.rb', line 103

def []=(key, value)
  Helpers::Invocation.raise_on_error(
    SDK::API.einstellung_setzen(
      key,
      convert_to_eric(value)
    )
  )
end