Module: ScormEngine::Api::Endpoints::Registrations::Configuration
- Included in:
- ScormEngine::Api::Endpoints
- Defined in:
- lib/scorm_engine/api/endpoints/registrations/configuration.rb
Instance Method Summary collapse
-
#get_registration_configuration(options = {}) ⇒ ScormEngine::Models::RegistrationConfiguration
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_registration_configuration_setting(options = {}) ⇒ String
Returns the effective value for this configuration setting for the resource being configured.
-
#post_registration_configuration(options = {}) ⇒ ScormEngine::Response
Bulk set configuration settings via POST request.
-
#put_registration_configuration_setting(options = {}) ⇒ ScormEngine::Response
Sets the value for this configuration setting, for the resource being configured.
Instance Method Details
#get_registration_configuration(options = {}) ⇒ ScormEngine::Models::RegistrationConfiguration
Returns the effective value of every setting at this level, as well as the effective value of any setting at a more specific level.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/scorm_engine/api/endpoints/registrations/configuration.rb', line 28 def get_registration_configuration( = {}) (, :registration_id) = .dup registration_id = .delete(:registration_id) response = get("registrations/#{registration_id}/configuration", ) result = response.success? ? ScormEngine::Models::RegistrationConfiguration.new_from_api(response.body) : nil Response.new(raw_response: response, result: result) end |
#get_registration_configuration_setting(options = {}) ⇒ String
Returns the effective value for this configuration setting for the resource being configured.
93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/scorm_engine/api/endpoints/registrations/configuration.rb', line 93 def get_registration_configuration_setting( = {}) (, :registration_id, :setting_id) = .dup registration_id = .delete(:registration_id) setting_id = .delete(:setting_id) response = get("registrations/#{registration_id}/configuration/#{setting_id}", ) result = response.success? ? response.body["value"] : nil Response.new(raw_response: response, result: result) end |
#post_registration_configuration(options = {}) ⇒ ScormEngine::Response
Bulk set configuration settings via POST request.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/scorm_engine/api/endpoints/registrations/configuration.rb', line 60 def post_registration_configuration( = {}) (, :registration_id, :settings) = .dup registration_id = .delete(:registration_id) settings = .delete(:settings) body = { settings: settings.map { |k, v| { "settingId" => k, "value" => v.to_s } } } response = post("registrations/#{registration_id}/configuration", , body) Response.new(raw_response: response) end |
#put_registration_configuration_setting(options = {}) ⇒ ScormEngine::Response
Sets the value for this configuration setting, for the resource being configured.
129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/scorm_engine/api/endpoints/registrations/configuration.rb', line 129 def put_registration_configuration_setting( = {}) (, :registration_id, :setting_id) = .dup registration_id = .delete(:registration_id) setting_id = .delete(:setting_id) body = { value: .delete(:value).to_s } response = put("registrations/#{registration_id}/configuration/#{setting_id}", , body) Response.new(raw_response: response) end |