Class: ScormEngine::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.


24
25
26
# File 'lib/scorm_engine/configuration.rb', line 24

def initialize
  reset
end

Instance Attribute Details

#hostObject


15
16
17
# File 'lib/scorm_engine/configuration.rb', line 15

def host
  @host
end

#log_optionsObject


22
23
24
# File 'lib/scorm_engine/configuration.rb', line 22

def log_options
  @log_options
end

#loggerObject


22
23
24
# File 'lib/scorm_engine/configuration.rb', line 22

def logger
  @logger
end

#passwordObject


18
19
20
# File 'lib/scorm_engine/configuration.rb', line 18

def password
  @password
end

#path_prefixObject


15
16
17
# File 'lib/scorm_engine/configuration.rb', line 15

def path_prefix
  @path_prefix
end

#protocolObject


15
16
17
# File 'lib/scorm_engine/configuration.rb', line 15

def protocol
  @protocol
end

#usernameObject


18
19
20
# File 'lib/scorm_engine/configuration.rb', line 18

def username
  @username
end

#v2_path_prefixObject


15
16
17
# File 'lib/scorm_engine/configuration.rb', line 15

def v2_path_prefix
  @v2_path_prefix
end

Instance Method Details

#resetObject


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/scorm_engine/configuration.rb', line 28

def reset
  @protocol = ENV.fetch("SCORM_ENGINE_PROTOCOL", "https")
  @host = ENV["SCORM_ENGINE_HOST"]
  @path_prefix = ENV.fetch("SCORM_ENGINE_PATH_PREFIX", "/ScormEngineInterface/api/v1/")
  @v2_path_prefix = ENV.fetch("SCORM_ENGINE_V2_PATH_PREFIX", "/ScormEngineInterface/api/v2/")

  @username = ENV["SCORM_ENGINE_USERNAME"]
  @password = ENV["SCORM_ENGINE_PASSWORD"]

  @logger = ::Logger.new(ENV.fetch("SCORM_ENGINE_LOGFILE", "/dev/null"))

  @log_options = begin
    JSON.parse(ENV.fetch("SCORM_ENGINE_LOG_OPTIONS"))
  rescue KeyError, JSON::ParserError
    { headers: false, bodies: false }
  end
end