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
-
#get_tenant_configuration ⇒ ScormEngine::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.
-
#get_tenant_configuration_setting(options = {}) ⇒ String
Returns the effective value for this configuration setting for the resource being configured.
-
#post_tenant_configuration(options = {}) ⇒ ScormEngine::Response
Bulk set configuration settings via POST request.
-
#put_tenant_configuration_setting(options = {}) ⇒ ScormEngine::Response
Sets the value for this configuration setting, for the resource being configured.
Instance Method Details
#get_tenant_configuration ⇒ ScormEngine::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.
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( = {}) (, :setting_id) = .dup setting_id = .delete(:setting_id) response = get("configuration/#{setting_id}", ) 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.
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( = {}) (, :settings) = .dup settings = .delete(:settings) body = { settings: settings.map { |k, v| { "settingId" => k, "value" => v.to_s } } } response = post("configuration", , 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.
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( = {}) (, :setting_id) = .dup setting_id = .delete(:setting_id) body = { value: .delete(:value).to_s } response = put("configuration/#{setting_id}", , body) Response.new(raw_response: response) end |