module AJIMS::LTI::Extensions::OutcomeData
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
Public Instance Methods
extention_process_xml(doc)
click to toggle source
Calls superclass method
# File lib/ajims/lti/extensions/outcome_data.rb, line 173 def extention_process_xml(doc) super @outcome_text = doc.get_text("//resultRecord/result/resultData/text") @outcome_url = doc.get_text("//resultRecord/result/resultData/url") @outcome_lti_launch_url = doc.get_text("//resultRecord/result/resultData/ltiLaunchUrl") @outcome_download_url = doc.get_text("//resultRecord/result/resultData/downloadUrl") @outcome_document_name = doc.get_text("//resultRecord/result/resultData/documentName") end
has_non_score_result_data?()
click to toggle source
# File lib/ajims/lti/extensions/outcome_data.rb, line 162 def has_non_score_result_data? !!@outcome_text || !!@outcome_cdata_text || !!@outcome_url || !!@outcome_lti_launch_url || (!!@outcome_download_url && !!@outcome_document_name) end
has_result_data?()
click to toggle source
Calls superclass method
# File lib/ajims/lti/extensions/outcome_data.rb, line 169 def has_result_data? has_non_score_result_data? || super end