Module: IMS::LTI::Extensions::OutcomeData
- Defined in:
- lib/ims/lti/extensions/outcome_data.rb
Overview
An LTI extension that adds support for sending data back to the consumer in addition to the score.
# Initialize TP object with OAuth creds and post parameters
provider = IMS::LTI::ToolProvider.new(consumer_key, consumer_secret, params)
# add extension
provider.extend IMS::LTI::Extensions::OutcomeData::ToolProvider
If the tool was launch as an outcome service and it supports the data extension you can POST a score to the TC. The POST calls all return an OutcomeResponse object which can be used to handle the response appropriately.
# post the score to the TC, score should be a float >= 0.0 and <= 1.0
# this returns an OutcomeResponse object
if provider.accepts_outcome_text?
response = provider.post_replace_result_with_data!(score, "text" => "submission text")
else
response = provider.post_replace_result!(score)
end
if response.success?
# grade write worked
elsif response.processing?
elsif response.unsupported?
else
# failed
end
Needs Grading outcome outcome_needs_grading is a flag to specify whether the submission should be needs_grading by the teacher It expects to be present or ‘true’ or ‘false’ value needs_grading by teacher or not, should set ‘needs grading’ in LMS if true or graded if false.
provider.post_replace_result_with_data!(score,'needs_grading' => 'true','url' => outcome_url)
Can also be used in conjunction with outcome_url to show url to a students state for grading
Defined Under Namespace
Modules: Base, OutcomeRequest, ToolConsumer, ToolProvider