mil-ims-lti 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog +4 -0
- data/lib/ims/lti/extensions/canvas.rb +109 -0
- data/lib/ims/lti/extensions/content.rb +209 -0
- data/lib/ims/lti/extensions/outcome_data.rb +35 -18
- data/lib/ims/lti/extensions.rb +2 -0
- data/lib/ims/lti/outcome_response.rb +14 -21
- data/lib/ims/lti/tool_consumer.rb +1 -1
- data/lib/ims/lti.rb +2 -0
- metadata +11 -9
- data/ims-lti.gemspec +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0e7fd0b27926f659e84907e606c6b07cfd3e037
|
|
4
|
+
data.tar.gz: 0d4c14c1aff274db63d64b2e232d41e28c54da3f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2319b59c2e8f72fcc9e0a014fb7ea71763b6e01b3ea131083a3503ebcda3028510f10fab95dc692f807e4d898a40e14196e5e90dd4b3d2de93a4524500484680
|
|
7
|
+
data.tar.gz: 28d7d2ca6f9dff2e4f9658e4b725887710afd0e4bdb65647e4d62d56b4287f8318457fe38504a6d1fa77d1e588674ae25f151094651fda0b35b01eaaf845f55f
|
data/Changelog
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
module IMS::LTI
|
|
2
|
+
module Extensions
|
|
3
|
+
# Module that adds Canvas specific LTI extensions
|
|
4
|
+
#
|
|
5
|
+
# It adds convenience methods for generating common canvas use case LTI configurations
|
|
6
|
+
#
|
|
7
|
+
# == Usage
|
|
8
|
+
# To generate an XML configuration:
|
|
9
|
+
#
|
|
10
|
+
# # Create a config object and set some options
|
|
11
|
+
# tc = IMS::LTI::ToolConfig.new(:title => "Example Sinatra Tool Provider", :launch_url => url)
|
|
12
|
+
# tc.description = "This example LTI Tool Provider supports LIS Outcome pass-back."
|
|
13
|
+
#
|
|
14
|
+
# # Extend the Canvas Tool config and add canvas related extensions
|
|
15
|
+
# tc.extend IMS::LTI::Extensions::Canvas::ToolConfig
|
|
16
|
+
# tc.homework_submission! 'http://someplace.com/homework', 'Find Homework'
|
|
17
|
+
#
|
|
18
|
+
# # generate the XML
|
|
19
|
+
# tc.to_xml
|
|
20
|
+
#
|
|
21
|
+
# Or to create a config object from an XML String:
|
|
22
|
+
#
|
|
23
|
+
# tc = IMS::LTI::ToolConfig.create_from_xml(xml)
|
|
24
|
+
|
|
25
|
+
module Canvas
|
|
26
|
+
module ToolConfig
|
|
27
|
+
PLATFORM = 'canvas.instructure.com'
|
|
28
|
+
|
|
29
|
+
# Canvas extension defaults
|
|
30
|
+
# These properties will cascade down to any options that are configured
|
|
31
|
+
|
|
32
|
+
def canvas_privacy_public!()
|
|
33
|
+
set_ext_param(PLATFORM, :privacy_level, 'public')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def canvas_privacy_name_only!()
|
|
37
|
+
set_ext_param(PLATFORM, :privacy_level, 'name_only')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def canvas_privacy_anonymous!()
|
|
41
|
+
set_ext_param(PLATFORM, :privacy_level, 'anonymous')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def canvas_domain!(domain)
|
|
45
|
+
set_ext_param(PLATFORM, :domain, domain)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def canvas_text!(text)
|
|
49
|
+
set_ext_param(PLATFORM, :text, text)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def canvas_icon_url!(icon_url)
|
|
53
|
+
set_ext_param(PLATFORM, :icon_url, icon_url)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def canvas_selector_dimensions!(width, height)
|
|
57
|
+
set_ext_param(PLATFORM, :selection_width, width)
|
|
58
|
+
set_ext_param(PLATFORM, :selection_height, height)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Canvas options
|
|
62
|
+
# These configure canvas to expose the tool in various locations. Any properties that are set
|
|
63
|
+
# at this level will override the defaults for this launch of the tool
|
|
64
|
+
|
|
65
|
+
# Enables homework submissions via the tool
|
|
66
|
+
# Valid properties are url, text, selection_width, selection_height, enabled
|
|
67
|
+
def canvas_homework_submission!(params = {})
|
|
68
|
+
set_ext_param(PLATFORM, :homework_submission, params)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Adds the tool to canvas' rich text editor
|
|
72
|
+
# Valid properties are url, icon_url, text, selection_width, selection_height, enabled
|
|
73
|
+
def canvas_editor_button!(params = {})
|
|
74
|
+
set_ext_param(PLATFORM, :editor_button, params)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Adds the tool to canvas' rich text editor
|
|
78
|
+
# Valid properties are url, icon_url, text, selection_width, selection_height, enabled
|
|
79
|
+
def canvas_resource_selection!(params = {})
|
|
80
|
+
set_ext_param(PLATFORM, :resource_selection, params)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Adds the tool to account level navigation in canvas
|
|
84
|
+
# Valid properties are url, text, enabled
|
|
85
|
+
def canvas_account_navigation!(params = {})
|
|
86
|
+
set_ext_param(PLATFORM, :account_navigation, params)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Adds the tool to course level navigation in canvas
|
|
90
|
+
# Valid properties are url, text, visibility, default, enabled
|
|
91
|
+
# Visibility describes who will see the navigation element. Possible values are "admins", "members", and nil
|
|
92
|
+
# Default determines if it is on or off by default. Possible values are "admins", "members", and nil
|
|
93
|
+
def canvas_course_navigation!(params = {})
|
|
94
|
+
set_ext_param(PLATFORM, :course_navigation, params)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Adds the tool to user level navigation in canvas
|
|
98
|
+
# Valid properties are url, text, enabled
|
|
99
|
+
def canvas_user_navigation!(params = {})
|
|
100
|
+
set_ext_param(PLATFORM, :user_navigation, params)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def get_canvas_param(param_key)
|
|
104
|
+
get_ext_param PLATFORM, param_key
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
module IMS::LTI
|
|
2
|
+
module Extensions
|
|
3
|
+
|
|
4
|
+
# An LTI extension that adds support for content back to the consumer
|
|
5
|
+
#
|
|
6
|
+
# # Initialize TP object with OAuth creds and post parameters
|
|
7
|
+
# provider = IMS::LTI::ToolProvider.new(consumer_key, consumer_secret, params)
|
|
8
|
+
# # add extension
|
|
9
|
+
# provider.extend IMS::LTI::Extensions::Content::ToolProvider
|
|
10
|
+
#
|
|
11
|
+
# If the tool was launched as an content request and it supports the content extension
|
|
12
|
+
# you can redirect the user to the tool consumer using the return url helper methods.
|
|
13
|
+
# The tool consumer is then responsible for consuming the content.
|
|
14
|
+
#
|
|
15
|
+
# #Check if a certain response type is available
|
|
16
|
+
# if provider.accepts_url? do
|
|
17
|
+
# #Generate the URL for the user
|
|
18
|
+
# redirect provider.url_content_return_url(url)
|
|
19
|
+
# end
|
|
20
|
+
#
|
|
21
|
+
module Content
|
|
22
|
+
module ToolProvider
|
|
23
|
+
include IMS::LTI::Extensions::ExtensionBase
|
|
24
|
+
include Base
|
|
25
|
+
|
|
26
|
+
# a list of the supported outcome data types
|
|
27
|
+
def accepted_content_types
|
|
28
|
+
return @content_types if @content_types
|
|
29
|
+
@content_types = []
|
|
30
|
+
if val = @ext_params["content_return_types"]
|
|
31
|
+
@content_types = val.split(',').map {|i| i.to_sym}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
@content_types
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def accepted_file_extensions
|
|
38
|
+
return @file_extensions if @file_extensions
|
|
39
|
+
@file_extensions = []
|
|
40
|
+
if val = @ext_params["content_file_extensions"]
|
|
41
|
+
@file_extensions = val.split(',').map {|i| i.downcase.strip}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
@file_extensions
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def accepts_file?(file_name = nil)
|
|
48
|
+
accepted_content_types.include?(:file) &&
|
|
49
|
+
( file_name.nil? ||
|
|
50
|
+
accepted_file_extensions.empty? ||
|
|
51
|
+
accepted_file_extensions.any?{|ext| file_name.downcase[/#{ext}$/]} )
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def accepts_url?
|
|
55
|
+
accepted_content_types.include?(:url)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def accepts_lti_launch_url?
|
|
59
|
+
accepted_content_types.include?(:lti_launch_url)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def accepts_image_url?
|
|
63
|
+
accepted_content_types.include?(:image_url)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def accepts_iframe?
|
|
67
|
+
accepted_content_types.include?(:iframe)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def accepts_oembed?
|
|
71
|
+
accepted_content_types.include?(:oembed)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def content_intended_use
|
|
75
|
+
@ext_params["content_intended_use"].to_sym if @ext_params["content_intended_use"]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# check if the content extension is supported
|
|
79
|
+
def accepts_content?
|
|
80
|
+
!!@ext_params["content_return_types"]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# check if the consumer accepts a given type of content
|
|
84
|
+
def accepts_content_type?(content_type)
|
|
85
|
+
accepted_content_types.include? content_type.to_sym
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
#check the use of the content
|
|
89
|
+
def is_content_for? (intended_use)
|
|
90
|
+
content_intended_use == intended_use
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def content_return_url
|
|
94
|
+
@ext_params["content_return_url"]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
#generates the return url for file submissions
|
|
98
|
+
def file_content_return_url(url, text, content_type = nil)
|
|
99
|
+
url = CGI::escape(url)
|
|
100
|
+
text = CGI::escape(text)
|
|
101
|
+
content_type = CGI::escape(content_type) if content_type
|
|
102
|
+
|
|
103
|
+
return_url = "#{content_return_url}?return_type=file&url=#{url}&text=#{text}"
|
|
104
|
+
return_url = "#{return_url}&content_type=#{content_type}" if content_type
|
|
105
|
+
|
|
106
|
+
return return_url
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
#generates the return url for url submissions
|
|
110
|
+
def url_content_return_url(url, title = nil, text = 'link', target = '_blank')
|
|
111
|
+
url = CGI::escape(url)
|
|
112
|
+
text = CGI::escape(text)
|
|
113
|
+
target = CGI::escape(target)
|
|
114
|
+
|
|
115
|
+
return_url = "#{content_return_url}?return_type=url&url=#{url}&text=#{text}&target=#{target}"
|
|
116
|
+
return_url = "#{return_url}&title=#{CGI::escape(title)}" if title
|
|
117
|
+
|
|
118
|
+
return return_url
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
#generates the return url for lti launch submissions
|
|
122
|
+
def lti_launch_content_return_url(url, text='link', title=nil)
|
|
123
|
+
url = CGI::escape(url)
|
|
124
|
+
text = CGI::escape(text)
|
|
125
|
+
|
|
126
|
+
return_url = "#{content_return_url}?return_type=lti_launch_url&url=#{url}&text=#{text}"
|
|
127
|
+
return_url = "#{return_url}&title=#{CGI::escape(title)}" if title
|
|
128
|
+
|
|
129
|
+
return return_url
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
#generates the return url for image submissions
|
|
133
|
+
def image_content_return_url(url, width, height, alt = '')
|
|
134
|
+
url = CGI::escape(url)
|
|
135
|
+
width = CGI::escape(width.to_s)
|
|
136
|
+
height = CGI::escape(height.to_s)
|
|
137
|
+
alt = CGI::escape(alt)
|
|
138
|
+
|
|
139
|
+
"#{content_return_url}?return_type=image_url&url=#{url}&width=#{width}&height=#{height}&alt=#{alt}"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
#generates the return url for iframe submissions
|
|
143
|
+
def iframe_content_return_url(url, width, height, title = nil)
|
|
144
|
+
url = CGI::escape(url)
|
|
145
|
+
width = CGI::escape(width.to_s)
|
|
146
|
+
height = CGI::escape(height.to_s)
|
|
147
|
+
|
|
148
|
+
return_url = "#{content_return_url}?return_type=iframe&url=#{url}&width=#{width}&height=#{height}"
|
|
149
|
+
return_url = "#{return_url}&title=#{CGI::escape(title)}" if title
|
|
150
|
+
|
|
151
|
+
return return_url
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
#generates the return url for oembed submissions
|
|
155
|
+
def oembed_content_return_url(url, endpoint)
|
|
156
|
+
url = CGI::escape(url)
|
|
157
|
+
endpoint = CGI::escape(endpoint)
|
|
158
|
+
|
|
159
|
+
"#{content_return_url}?return_type=oembed&url=#{url}&endpoint=#{endpoint}"
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
module ToolConsumer
|
|
164
|
+
include IMS::LTI::Extensions::ExtensionBase
|
|
165
|
+
include Base
|
|
166
|
+
|
|
167
|
+
# a list of the content types accepted
|
|
168
|
+
#
|
|
169
|
+
# tc.add_content_return_types=(['url', 'text'])
|
|
170
|
+
# tc.add_content_return_types=("url,text")
|
|
171
|
+
def content_return_types=(val)
|
|
172
|
+
val = val.join(',') if val.is_a? Array
|
|
173
|
+
set_ext_param('content_return_types', val)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# a comma-separated string of the supported outcome data types
|
|
177
|
+
def content_return_types
|
|
178
|
+
get_ext_param('content_return_types')
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
def content_intended_use=(val)
|
|
182
|
+
set_ext_param('content_intended_use', val)
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def content_intended_use
|
|
186
|
+
get_ext_param('content_intended_use')
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# convenience method for setting support for homework content
|
|
190
|
+
def support_homework_content!
|
|
191
|
+
self.content_intended_use = 'homework'
|
|
192
|
+
self.content_return_types = 'file,url'
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# convenience method for setting support for embed content
|
|
196
|
+
def support_embed_content!
|
|
197
|
+
self.content_intended_use = 'embed'
|
|
198
|
+
self.content_return_types = 'oembed,lti_launch_url,url,image_url,iframe'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# convenience method for setting support for navigation content
|
|
202
|
+
def support_navigation_content!
|
|
203
|
+
self.content_intended_use = 'navigation'
|
|
204
|
+
self.content_return_types = 'lti_launch_url'
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
@@ -28,6 +28,14 @@ module IMS::LTI
|
|
|
28
28
|
# else
|
|
29
29
|
# # failed
|
|
30
30
|
# end
|
|
31
|
+
#
|
|
32
|
+
# Graded outcome +outcome_graded+ is a flag to specify whether the submission should be graded by the teacher
|
|
33
|
+
# It expects a 'true' or 'false' value graded by teacher or not, should set 'needs grading' in LMS if true.
|
|
34
|
+
#
|
|
35
|
+
# provider.post_replace_result_with_data!(score,'graded' => 'true','url' => outcome_url)
|
|
36
|
+
#
|
|
37
|
+
# Can also be used in conjunction with outcome_url to show url to a students state for grading
|
|
38
|
+
#
|
|
31
39
|
module OutcomeData
|
|
32
40
|
|
|
33
41
|
#IMS::LTI::Extensions::OutcomeData::ToolProvider
|
|
@@ -45,7 +53,7 @@ module IMS::LTI
|
|
|
45
53
|
def accepted_outcome_types
|
|
46
54
|
return @outcome_types if @outcome_types
|
|
47
55
|
@outcome_types = []
|
|
48
|
-
if val = @ext_params[
|
|
56
|
+
if val = @ext_params['outcome_data_values_accepted']
|
|
49
57
|
@outcome_types = val.split(',')
|
|
50
58
|
end
|
|
51
59
|
|
|
@@ -54,21 +62,27 @@ module IMS::LTI
|
|
|
54
62
|
|
|
55
63
|
# check if the outcome data extension is supported
|
|
56
64
|
def accepts_outcome_data?
|
|
57
|
-
!!@ext_params[
|
|
65
|
+
!!@ext_params['outcome_data_values_accepted']
|
|
58
66
|
end
|
|
59
67
|
|
|
60
68
|
# check if the consumer accepts text as outcome data
|
|
61
69
|
def accepts_outcome_text?
|
|
62
|
-
accepted_outcome_types.member?(
|
|
70
|
+
accepted_outcome_types.member?('text')
|
|
63
71
|
end
|
|
64
72
|
|
|
65
73
|
# check if the consumer accepts a url as outcome data
|
|
66
74
|
def accepts_outcome_url?
|
|
67
|
-
accepted_outcome_types.member?(
|
|
75
|
+
accepted_outcome_types.member?('url')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# check if the consumer accepts a graded as outcome data
|
|
79
|
+
def accepts_outcome_graded?
|
|
80
|
+
accepted_outcome_types.member?('graded')
|
|
68
81
|
end
|
|
69
82
|
|
|
70
83
|
# POSTs the given score to the Tool Consumer with a replaceResult and
|
|
71
|
-
# adds the specified data. The data hash can have the keys "text", "cdata_text",
|
|
84
|
+
# adds the specified data. The data hash can have the keys "text", "cdata_text",
|
|
85
|
+
# "url" or "graded" (Graded expects a true/false value)
|
|
72
86
|
#
|
|
73
87
|
# If both cdata_text and text are sent, cdata_text will be used
|
|
74
88
|
#
|
|
@@ -77,12 +91,13 @@ module IMS::LTI
|
|
|
77
91
|
# @return [OutcomeResponse] the response from the Tool Consumer
|
|
78
92
|
def post_replace_result_with_data!(score, data={})
|
|
79
93
|
req = new_request
|
|
80
|
-
if data[
|
|
81
|
-
req.outcome_cdata_text = data[
|
|
82
|
-
elsif data[
|
|
83
|
-
req.outcome_text = data[
|
|
94
|
+
if data['cdata_text']
|
|
95
|
+
req.outcome_cdata_text = data['cdata_text']
|
|
96
|
+
elsif data['text']
|
|
97
|
+
req.outcome_text = data['text']
|
|
84
98
|
end
|
|
85
|
-
req.outcome_url = data[
|
|
99
|
+
req.outcome_url = data['url'] if data['url']
|
|
100
|
+
req.outcome_graded = data['graded'] if data['graded']
|
|
86
101
|
req.post_replace_result!(score)
|
|
87
102
|
end
|
|
88
103
|
|
|
@@ -92,10 +107,10 @@ module IMS::LTI
|
|
|
92
107
|
include IMS::LTI::Extensions::ExtensionBase
|
|
93
108
|
include Base
|
|
94
109
|
|
|
95
|
-
OUTCOME_DATA_TYPES = %w{text url}
|
|
110
|
+
OUTCOME_DATA_TYPES = %w{text url graded}
|
|
96
111
|
|
|
97
|
-
# a list of the outcome data types accepted, currently only 'url'
|
|
98
|
-
# 'text' are valid
|
|
112
|
+
# a list of the outcome data types accepted, currently only 'url',
|
|
113
|
+
# 'text' and 'graded' are valid
|
|
99
114
|
#
|
|
100
115
|
# tc.outcome_data_values_accepted(['url', 'text'])
|
|
101
116
|
# tc.outcome_data_valued_accepted("url,text")
|
|
@@ -122,11 +137,11 @@ module IMS::LTI
|
|
|
122
137
|
include IMS::LTI::Extensions::ExtensionBase
|
|
123
138
|
include Base
|
|
124
139
|
|
|
125
|
-
attr_accessor :outcome_text, :outcome_url, :outcome_cdata_text
|
|
140
|
+
attr_accessor :outcome_text, :outcome_url, :outcome_graded, :outcome_cdata_text
|
|
126
141
|
|
|
127
142
|
def result_values(node)
|
|
128
143
|
super
|
|
129
|
-
if @outcome_text || @outcome_url || @outcome_cdata_text
|
|
144
|
+
if @outcome_text || @outcome_url || @outcome_graded || @outcome_cdata_text
|
|
130
145
|
node.resultData do |res_data|
|
|
131
146
|
if @outcome_cdata_text
|
|
132
147
|
res_data.text {
|
|
@@ -136,18 +151,20 @@ module IMS::LTI
|
|
|
136
151
|
res_data.text @outcome_text
|
|
137
152
|
end
|
|
138
153
|
res_data.url @outcome_url if @outcome_url
|
|
154
|
+
res_data.graded @outcome_graded if @outcome_graded
|
|
139
155
|
end
|
|
140
156
|
end
|
|
141
157
|
end
|
|
142
158
|
|
|
143
159
|
def has_result_data?
|
|
144
|
-
!!@outcome_text || !!@outcome_url || super
|
|
160
|
+
!!@outcome_text || !!@outcome_url || !!@outcome_graded || super
|
|
145
161
|
end
|
|
146
162
|
|
|
147
163
|
def extention_process_xml(doc)
|
|
148
164
|
super
|
|
149
|
-
@outcome_text
|
|
150
|
-
@outcome_url
|
|
165
|
+
@outcome_text = doc.get_text('//resultRecord/result/resultData/text')
|
|
166
|
+
@outcome_url = doc.get_text('//resultRecord/result/resultData/url')
|
|
167
|
+
@outcome_graded = doc.get_text('//resultRecord/result/resultData/graded')
|
|
151
168
|
end
|
|
152
169
|
end
|
|
153
170
|
|
data/lib/ims/lti/extensions.rb
CHANGED
|
@@ -105,28 +105,21 @@ module IMS::LTI
|
|
|
105
105
|
|
|
106
106
|
# Parse Outcome Response data from XML
|
|
107
107
|
def process_xml(xml)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
rescue REXML::ParseException => e
|
|
121
|
-
@message_identifier = ''
|
|
122
|
-
@code_major = 'failure'
|
|
123
|
-
@severity = 'status'
|
|
124
|
-
@description = "#{e}"
|
|
125
|
-
@message_ref_identifier = '123456789'
|
|
126
|
-
@operation = 'replaceResult'
|
|
127
|
-
@score = ''
|
|
128
|
-
end
|
|
108
|
+
doc = REXML::Document.new xml
|
|
109
|
+
@message_identifier = doc.text('//imsx_statusInfo/imsx_messageIdentifier').to_s
|
|
110
|
+
@code_major = doc.text('//imsx_statusInfo/imsx_codeMajor')
|
|
111
|
+
@code_major.downcase! if @code_major
|
|
112
|
+
@severity = doc.text('//imsx_statusInfo/imsx_severity')
|
|
113
|
+
@severity.downcase! if @severity
|
|
114
|
+
@description = doc.text('//imsx_statusInfo/imsx_description')
|
|
115
|
+
@description = @description.to_s if @description
|
|
116
|
+
@message_ref_identifier = doc.text('//imsx_statusInfo/imsx_messageRefIdentifier')
|
|
117
|
+
@operation = doc.text('//imsx_statusInfo/imsx_operationRefIdentifier')
|
|
118
|
+
@score = doc.text('//readResultResponse//resultScore/textString')
|
|
119
|
+
|
|
129
120
|
@score = @score.to_s if @score
|
|
121
|
+
rescue
|
|
122
|
+
raise IMS::LTI::InvalidLTIResponseData, ''
|
|
130
123
|
end
|
|
131
124
|
|
|
132
125
|
# Generate XML based on the current configuration
|
|
@@ -49,7 +49,7 @@ module IMS::LTI
|
|
|
49
49
|
raise IMS::LTI::InvalidLTIConfigError, "Not all required params set for tool launch" unless has_required_params?
|
|
50
50
|
|
|
51
51
|
params = self.to_params
|
|
52
|
-
params['lti_version'] ||= 'LTI-
|
|
52
|
+
params['lti_version'] ||= 'LTI-1p0'
|
|
53
53
|
params['lti_message_type'] ||= 'basic-lti-launch-request'
|
|
54
54
|
uri = URI.parse(@launch_url)
|
|
55
55
|
|
data/lib/ims/lti.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mil-ims-lti
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Instructure
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -87,13 +87,10 @@ extensions: []
|
|
|
87
87
|
extra_rdoc_files:
|
|
88
88
|
- LICENSE
|
|
89
89
|
files:
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- README.md
|
|
93
|
-
- lib/ims.rb
|
|
94
|
-
- lib/ims/lti.rb
|
|
95
|
-
- lib/ims/lti/extensions.rb
|
|
90
|
+
- lib/ims/lti/extensions/canvas.rb
|
|
91
|
+
- lib/ims/lti/extensions/content.rb
|
|
96
92
|
- lib/ims/lti/extensions/outcome_data.rb
|
|
93
|
+
- lib/ims/lti/extensions.rb
|
|
97
94
|
- lib/ims/lti/launch_params.rb
|
|
98
95
|
- lib/ims/lti/outcome_request.rb
|
|
99
96
|
- lib/ims/lti/outcome_response.rb
|
|
@@ -101,7 +98,11 @@ files:
|
|
|
101
98
|
- lib/ims/lti/tool_config.rb
|
|
102
99
|
- lib/ims/lti/tool_consumer.rb
|
|
103
100
|
- lib/ims/lti/tool_provider.rb
|
|
104
|
-
- ims
|
|
101
|
+
- lib/ims/lti.rb
|
|
102
|
+
- lib/ims.rb
|
|
103
|
+
- LICENSE
|
|
104
|
+
- README.md
|
|
105
|
+
- Changelog
|
|
105
106
|
homepage: http://github.com/instructure/ims-lti
|
|
106
107
|
licenses: []
|
|
107
108
|
metadata: {}
|
|
@@ -126,3 +127,4 @@ signing_key:
|
|
|
126
127
|
specification_version: 4
|
|
127
128
|
summary: Ruby library for creating IMS LTI tool providers and consumers
|
|
128
129
|
test_files: []
|
|
130
|
+
has_rdoc:
|
data/ims-lti.gemspec
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
Gem::Specification.new do |s|
|
|
2
|
-
s.name = %q{ims-lti}
|
|
3
|
-
s.version = "1.1.3"
|
|
4
|
-
|
|
5
|
-
s.add_dependency 'builder'
|
|
6
|
-
s.add_dependency 'oauth', '~> 0.4.5'
|
|
7
|
-
s.add_dependency 'uuid'
|
|
8
|
-
|
|
9
|
-
s.add_development_dependency 'rspec'
|
|
10
|
-
s.add_development_dependency 'ruby-deug'
|
|
11
|
-
|
|
12
|
-
s.authors = ["Instructure"]
|
|
13
|
-
s.date = %q{2012-09-05}
|
|
14
|
-
s.extra_rdoc_files = %W(LICENSE)
|
|
15
|
-
s.files = %W(
|
|
16
|
-
Changelog
|
|
17
|
-
LICENSE
|
|
18
|
-
README.md
|
|
19
|
-
lib/ims.rb
|
|
20
|
-
lib/ims/lti.rb
|
|
21
|
-
lib/ims/lti/extensions.rb
|
|
22
|
-
lib/ims/lti/extensions/outcome_data.rb
|
|
23
|
-
lib/ims/lti/launch_params.rb
|
|
24
|
-
lib/ims/lti/outcome_request.rb
|
|
25
|
-
lib/ims/lti/outcome_response.rb
|
|
26
|
-
lib/ims/lti/request_validator.rb
|
|
27
|
-
lib/ims/lti/tool_config.rb
|
|
28
|
-
lib/ims/lti/tool_consumer.rb
|
|
29
|
-
lib/ims/lti/tool_provider.rb
|
|
30
|
-
ims-lti.gemspec
|
|
31
|
-
)
|
|
32
|
-
s.homepage = %q{http://github.com/instructure/ims-lti}
|
|
33
|
-
s.require_paths = %W(lib)
|
|
34
|
-
s.summary = %q{Ruby library for creating IMS LTI tool providers and consumers}
|
|
35
|
-
end
|