Module: AJIMS::LTI::Extensions::OutcomeData::ToolProvider
- Includes:
- ExtensionBase, Base
- Defined in:
- lib/ajims/lti/extensions/outcome_data.rb
Instance Method Summary collapse
-
#accepted_outcome_types ⇒ Object
a list of the supported outcome data types.
-
#accepts_outcome_data? ⇒ Boolean
check if the outcome data extension is supported.
-
#accepts_outcome_text? ⇒ Boolean
check if the consumer accepts text as outcome data.
-
#accepts_outcome_url? ⇒ Boolean
check if the consumer accepts a url as outcome data.
-
#post_replace_result_with_data!(score = nil, data = {}) ⇒ OutcomeResponse
POSTs the given score to the Tool Consumer with a replaceResult and adds the specified data.
Methods included from Base
Methods included from ExtensionBase
#outcome_request_extensions, #outcome_response_extensions
Instance Method Details
#accepted_outcome_types ⇒ Object
a list of the supported outcome data types
45 46 47 48 49 50 51 52 53 |
# 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? ⇒ Boolean
check if the outcome data extension is supported
56 57 58 |
# File 'lib/ajims/lti/extensions/outcome_data.rb', line 56 def accepts_outcome_data? !!@ext_params["outcome_data_values_accepted"] end |
#accepts_outcome_text? ⇒ Boolean
check if the consumer accepts text as outcome data
61 62 63 |
# File 'lib/ajims/lti/extensions/outcome_data.rb', line 61 def accepts_outcome_text? accepted_outcome_types.member?("text") end |
#accepts_outcome_url? ⇒ Boolean
check if the consumer accepts a url as outcome data
66 67 68 |
# 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 = {}) ⇒ OutcomeResponse
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
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# 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 |