Class: ScormEngine::Models::TenantConfiguration

Inherits:
Base
  • Object
show all
Defined in:
lib/scorm_engine/models/tenant_configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#to_hash

Instance Attribute Details

#settingsHash

Returns:

  • (Hash)


7
8
9
# File 'lib/scorm_engine/models/tenant_configuration.rb', line 7

def settings
  @settings
end

Class Method Details

.get_settings_from_api(options = {}) ⇒ Hash

Extract and normalize the settings from the API options.

Parameters:

  • options (Hash) (defaults to: {})

    The API options hash

Returns:

  • (Hash)

    A hash of key/value pairs.



26
27
28
29
30
31
# File 'lib/scorm_engine/models/tenant_configuration.rb', line 26

def self.get_settings_from_api(options = {})
  options["configurationItems"].reduce({}) do |m, o|
    m[o["id"]] = o["value"]
    m
  end
end

.new_from_api(options = {}) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/scorm_engine/models/tenant_configuration.rb', line 9

def self.new_from_api(options = {})
  this = new

  this.options = options.dup
  this.settings = get_settings_from_api(options)
  this
end