module ScormEngine::Api::Endpoints::Courses::Configuration

Public Instance Methods

get_course_configuration(options = {}) click to toggle source

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

@see rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__courses__courseId__configuration_get

@param [Hash] options

@option options [String] :course_id

The ID of the course to get.

@option options [Integer] :version (nil)

The version of this course to use. If not provided, the latest
version will be used.

@return [ScormEngine::Models::CourseConfiguration]

# File lib/scorm_engine/api/endpoints/courses/configuration.rb, line 28
def get_course_configuration(options = {})
  require_options(options, :course_id)

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

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

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

  Response.new(raw_response: response, result: result)
end
get_course_configuration_setting(options = {}) click to toggle source

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

@see rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__courses__courseId__configuration__settingId__get

@param [Hash] options

@option options [String] :course_id

The ID of the course to get.

@option options [String] :setting_id

The ID of the setting to get.

@option options [Integer] :version (nil)

The version of this course to use. If not provided, the latest
version will be used.

@return [String]

# File lib/scorm_engine/api/endpoints/courses/configuration.rb, line 93
def get_course_configuration_setting(options = {})
  require_options(options, :course_id, :setting_id)

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

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

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

  Response.new(raw_response: response, result: result)
end
post_course_configuration(options = {}) click to toggle source

Bulk set configuration settings via POST request.

@see rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__courses__courseId__configuration_post

@param [Hash] options

@option options [String] :course_id

The ID of the course to set.

@option options [Integer] :version (nil)

The version of this course to use. If not provided, the latest
version will be used.

@option options [Hash] :settings

Key/value pairs of configuration options to set.

@return [ScormEngine::Response]

# File lib/scorm_engine/api/endpoints/courses/configuration.rb, line 60
def post_course_configuration(options = {})
  require_options(options, :course_id, :settings)

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

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

  response = post("courses/#{course_id}/configuration", options, body)

  Response.new(raw_response: response)
end
put_course_configuration_setting(options = {}) click to toggle source

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

@see rustici-docs.s3.amazonaws.com/engine/2017.1.x/api.html#tenant__courses__courseId__configuration__settingId__put

@param [Hash] options

@option options [String] :course_id

The ID of the course to set.

@option options [String] :setting_id

The ID of the setting to set.

@option options [String] :value (“”)

The value of the setting to set.

@option options [Integer] :version (nil)

The version of this course to use. If not provided, the latest
version will be used.

@return [ScormEngine::Response]

# File lib/scorm_engine/api/endpoints/courses/configuration.rb, line 129
def put_course_configuration_setting(options = {})
  require_options(options, :course_id, :setting_id)

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

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

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

  Response.new(raw_response: response)
end