module AJIMS::LTI::Extensions::OutcomeData::ToolProvider
Public Instance Methods
accepted_outcome_types()
click to toggle source
a list of the supported outcome data types
# File lib/ajims/lti/extensions/outcome_data.rb, line 45 def accepted_outcome_types return @outcome_types if @outcome_types @outcome_types = [] if val = @ext_params["outcome_data_values_accepted"] @outcome_types = val.split(',') end @outcome_types end
accepts_outcome_data?()
click to toggle source
check if the outcome data extension is supported
# File lib/ajims/lti/extensions/outcome_data.rb, line 56 def accepts_outcome_data? !!@ext_params["outcome_data_values_accepted"] end
accepts_outcome_text?()
click to toggle source
check if the consumer accepts text as outcome data
# File lib/ajims/lti/extensions/outcome_data.rb, line 61 def accepts_outcome_text? accepted_outcome_types.member?("text") end
accepts_outcome_url?()
click to toggle source
check if the consumer accepts a url as outcome data
# File lib/ajims/lti/extensions/outcome_data.rb, line 66 def accepts_outcome_url? accepted_outcome_types.member?("url") end
post_replace_result_with_data!(score = nil, data={})
click to toggle source
POSTs the given score to the Tool Consumer with a replaceResult and adds the specified data. The data hash can have the keys “text”, “cdata_text”, or “url”
If both cdata_text and text are sent, cdata_text will be used
If score is nil, the replace result XML will not contain a resultScore node
Creates a new OutcomeRequest
object and stores it in @outcome_requests
@return [OutcomeResponse] the response from the Tool Consumer
# File lib/ajims/lti/extensions/outcome_data.rb, line 80 def post_replace_result_with_data!(score = nil, data={}) req = new_request if data["cdata_text"] req.outcome_cdata_text = data["cdata_text"] elsif data["text"] req.outcome_text = data["text"] end if data["lti_launch_url"] req.outcome_lti_launch_url = data["lti_launch_url"] if data["lti_launch_url"] elsif data["download_url"] && data["document_name"] req.outcome_download_url = data["download_url"] req.outcome_document_name = data["document_name"] else req.outcome_url = data["url"] if data["url"] end req.post_replace_result!(score, submitted_at: data["submitted_at"]) end