Module: ScormEngine::Api::Endpoints::Tenants::Configuration

Included in:
ScormEngine::Api::Endpoints
Defined in:
lib/scorm_engine/api/endpoints/tenants/configuration.rb

Instance Method Summary collapse

Instance Method Details

#get_tenant_configurationScormEngine::Models::TenantConfiguration

Returns the effective value of every setting at this level, as well as the effective value of any setting at a more specific level.



19
20
21
22
23
24
25
# File 'lib/scorm_engine/api/endpoints/tenants/configuration.rb', line 19

def get_tenant_configuration
  response = get("configuration")

  result = response.success? ? ScormEngine::Models::TenantConfiguration.new_from_api(response.body) : nil

  Response.new(raw_response: response, result: result)
end

#get_tenant_configuration_setting(options = {}) ⇒ String

Returns the effective value for this configuration setting for the resource being configured.

Parameters:

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

Options Hash (options):

  • :setting_id (String)

    The ID of the setting to get.

Returns:

  • (String)

See Also:



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/scorm_engine/api/endpoints/tenants/configuration.rb', line 64

def get_tenant_configuration_setting(options = {})
  require_options(options, :setting_id)

  options = options.dup
  setting_id = options.delete(:setting_id)

  response = get("configuration/#{setting_id}", options)

  result = response.success? ? response.body["value"] : nil

  Response.new(raw_response: response, result: result)
end

#post_tenant_configuration(options = {}) ⇒ ScormEngine::Response

Bulk set configuration settings via POST request.

Parameters:

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

Options Hash (options):

  • :settings (Hash)

    Key/value pairs of configuration options to set.

Returns:

See Also:



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/scorm_engine/api/endpoints/tenants/configuration.rb', line 39

def post_tenant_configuration(options = {})
  require_options(options, :settings)

  options = options.dup
  settings = options.delete(:settings)

  body = { settings: settings.map { |k, v| { "settingId" => k, "value" => v.to_s } } }

  response = post("configuration", options, body)

  Response.new(raw_response: response)
end

#put_tenant_configuration_setting(options = {}) ⇒ ScormEngine::Response

Sets the value for this configuration setting, for the resource being configured.

Parameters:

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

Options Hash (options):

  • :setting_id (String)

    The ID of the setting to set.

  • :value (String) — default: ""

    The value of the setting to set.

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/scorm_engine/api/endpoints/tenants/configuration.rb', line 92

def put_tenant_configuration_setting(options = {})
  require_options(options, :setting_id)

  options = options.dup
  setting_id = options.delete(:setting_id)

  body = { value: options.delete(:value).to_s }

  response = put("configuration/#{setting_id}", options, body)

  Response.new(raw_response: response)
end