module IMS::LTI::Extensions::OutcomeData::ToolProvider

Public Instance Methods

accepted_outcome_types() click to toggle source

a list of the supported outcome data types

# File lib/ims/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/ims/lti/extensions/outcome_data.rb, line 56
def accepts_outcome_data?
  !!@ext_params["outcome_data_values_accepted"]
end
accepts_outcome_lti_launch_url?() click to toggle source
# File lib/ims/lti/extensions/outcome_data.rb, line 75
def accepts_outcome_lti_launch_url?
  accepted_outcome_types.member?("lti_launch_url")
end
accepts_outcome_result_total_score?() click to toggle source
# File lib/ims/lti/extensions/outcome_data.rb, line 79
def accepts_outcome_result_total_score?
  !!@ext_params["outcome_result_total_score_accepted"]
end
accepts_outcome_text?() click to toggle source

check if the consumer accepts text as outcome data

# File lib/ims/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/ims/lti/extensions/outcome_data.rb, line 66
def accepts_outcome_url?
  accepted_outcome_types.member?("url")
end
accepts_submitted_at?() click to toggle source

check if the consumer accepts a submitted at date as outcome data

# File lib/ims/lti/extensions/outcome_data.rb, line 71
def accepts_submitted_at?
  accepted_outcome_types.member?("submitted_at")
end
post_extended_replace_result!(options = {}) click to toggle source

POSTs the given score to the Tool Consumer with a replaceResult and adds the specified data. The options hash can have the keys :text, :cdata_text, :url, :submitted_at, :lti_launch_url, :score, or :total_score

If both cdata_text and text are sent, cdata_text will be used If both total_score and score are sent, total_score 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/ims/lti/extensions/outcome_data.rb, line 110
def post_extended_replace_result!(options = {})
  opts = {}
  options.each {|k,v| opts[k.to_sym] = v}

  req = new_request
  req.outcome_cdata_text = opts[:cdata_text]
  req.outcome_text = opts[:text]
  req.outcome_url = opts[:url]
  req.submitted_at = opts[:submitted_at]
  req.outcome_lti_launch_url = opts[:lti_launch_url]
  req.total_score = opts[:total_score]
  req.post_replace_result!(opts[:score])
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”, “url”, “submitted_at” or “lti_launch_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 @deprecated Use post_extended_replace_result! instead

# File lib/ims/lti/extensions/outcome_data.rb, line 94
def post_replace_result_with_data!(score = nil, data={})
  data[:score] = score if score
  post_extended_replace_result!(data)
end