Module: IMS::LTI::Extensions::OutcomeData::OutcomeRequest

Includes:
ExtensionBase, Base
Defined in:
lib/ims/lti/extensions/outcome_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Base

#outcome_request_extensions

Methods included from ExtensionBase

#outcome_request_extensions, #outcome_response_extensions

Instance Attribute Details

#outcome_cdata_textObject

Returns the value of attribute outcome_cdata_text.



148
149
150
# File 'lib/ims/lti/extensions/outcome_data.rb', line 148

def outcome_cdata_text
  @outcome_cdata_text
end

#outcome_textObject

Returns the value of attribute outcome_text.



148
149
150
# File 'lib/ims/lti/extensions/outcome_data.rb', line 148

def outcome_text
  @outcome_text
end

#outcome_urlObject

Returns the value of attribute outcome_url.



148
149
150
# File 'lib/ims/lti/extensions/outcome_data.rb', line 148

def outcome_url
  @outcome_url
end

#total_scoreObject

Returns the value of attribute total_score.



148
149
150
# File 'lib/ims/lti/extensions/outcome_data.rb', line 148

def total_score
  @total_score
end

Instance Method Details

#extention_process_xml(doc) ⇒ Object



182
183
184
185
186
# File 'lib/ims/lti/extensions/outcome_data.rb', line 182

def extention_process_xml(doc)
  super
  @outcome_text = doc.get_text("//resultRecord/result/resultData/text")
  @outcome_url = doc.get_text("//resultRecord/result/resultData/url")
end

#has_result_data?Boolean

Returns:

  • (Boolean)


178
179
180
# File 'lib/ims/lti/extensions/outcome_data.rb', line 178

def has_result_data?
  !!outcome_text || !!outcome_url || !!outcome_cdata_text || !!total_score || super
end

#result_values(node) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/ims/lti/extensions/outcome_data.rb', line 150

def result_values(node)
  super

  if total_score
    node.resultTotalScore do |res_total_score|
      res_total_score.language "en" # 'en' represents the format of the number
      res_total_score.textString total_score.to_s
    end
  end

  if outcome_text || outcome_url || outcome_cdata_text
    node.resultData do |res_data|
      if outcome_cdata_text
        res_data.text {
          res_data.cdata! outcome_cdata_text
        }
      elsif outcome_text
        res_data.text outcome_text
      end
      res_data.url outcome_url if outcome_url
    end
  end
end

#scoreObject



174
175
176
# File 'lib/ims/lti/extensions/outcome_data.rb', line 174

def score
  total_score ? nil : @score
end