ims-lti 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ims/lti/extensions/content.rb +76 -27
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29574604b1d50bb3ad7a18357c73989e650cc7eaee9693115661f4b1fba01369
|
4
|
+
data.tar.gz: 7d3ce283cf78880097a4803f35ef96f0e2cdea74d49e17a6b45982b9f5171390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8effe8dd1fe14c17dd01a41c4f3c719a0201717d72b244b5d181df53df0de9ec13bec6bed53f1f9aa873c2cb9ada99dfad4eadc94818003610a287a56d8884f1
|
7
|
+
data.tar.gz: a738260e51baa9a6a61db871ad3807e73dbf3918e1fd45da1cf27d6be0fd61bdf8e597579f8ac68c639936c848bb5d676dddacd7d592f784e1051bc9db2aa7d0
|
@@ -96,67 +96,116 @@ module IMS::LTI
|
|
96
96
|
|
97
97
|
#generates the return url for file submissions
|
98
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
99
|
|
103
|
-
return_url =
|
104
|
-
|
100
|
+
return_url = add_parameters(content_return_url, {
|
101
|
+
return_type: 'file',
|
102
|
+
url: url,
|
103
|
+
text: text
|
104
|
+
})
|
105
|
+
|
106
|
+
if content_type
|
107
|
+
return_url = add_parameters(return_url, {
|
108
|
+
content_type: content_type
|
109
|
+
})
|
110
|
+
end
|
105
111
|
|
106
112
|
return return_url
|
107
113
|
end
|
108
114
|
|
109
115
|
#generates the return url for url submissions
|
110
116
|
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
117
|
|
115
|
-
return_url =
|
116
|
-
|
118
|
+
return_url = add_parameters(content_return_url, {
|
119
|
+
return_type: 'url',
|
120
|
+
url: url,
|
121
|
+
text: text,
|
122
|
+
target: target
|
123
|
+
})
|
124
|
+
|
125
|
+
if title
|
126
|
+
return_url = add_parameters(return_url, {
|
127
|
+
title:title
|
128
|
+
})
|
129
|
+
end
|
117
130
|
|
118
131
|
return return_url
|
119
132
|
end
|
120
133
|
|
121
134
|
#generates the return url for lti launch submissions
|
122
135
|
def lti_launch_content_return_url(url, text='link', title=nil)
|
123
|
-
url = CGI::escape(url)
|
124
|
-
text = CGI::escape(text)
|
125
136
|
|
126
|
-
return_url =
|
127
|
-
|
137
|
+
return_url = add_parameters(content_return_url, {
|
138
|
+
return_type: 'lti_launch_url',
|
139
|
+
url: url,
|
140
|
+
text: text
|
141
|
+
})
|
142
|
+
|
143
|
+
if title
|
144
|
+
return_url = add_parameters(return_url, {
|
145
|
+
title:title
|
146
|
+
})
|
147
|
+
end
|
128
148
|
|
129
149
|
return return_url
|
130
150
|
end
|
131
151
|
|
132
152
|
#generates the return url for image submissions
|
133
153
|
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
154
|
|
139
|
-
|
155
|
+
add_parameters(content_return_url, {
|
156
|
+
return_type: 'image_url',
|
157
|
+
url: url,
|
158
|
+
width: width.to_s,
|
159
|
+
height: height.to_s,
|
160
|
+
alt: alt
|
161
|
+
})
|
140
162
|
end
|
141
163
|
|
142
164
|
#generates the return url for iframe submissions
|
143
165
|
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
166
|
|
148
|
-
return_url =
|
149
|
-
|
167
|
+
return_url = add_parameters(content_return_url, {
|
168
|
+
return_type: 'iframe',
|
169
|
+
url: url,
|
170
|
+
width: width.to_s,
|
171
|
+
height: height.to_s
|
172
|
+
})
|
173
|
+
|
174
|
+
if title
|
175
|
+
return_url = add_parameters(return_url, {
|
176
|
+
title:title
|
177
|
+
})
|
178
|
+
end
|
150
179
|
|
151
180
|
return return_url
|
152
181
|
end
|
153
182
|
|
154
183
|
#generates the return url for oembed submissions
|
155
184
|
def oembed_content_return_url(url, endpoint)
|
156
|
-
url = CGI::escape(url)
|
157
|
-
endpoint = CGI::escape(endpoint)
|
158
185
|
|
159
|
-
|
186
|
+
add_parameters(content_return_url, {
|
187
|
+
return_type: 'oembed',
|
188
|
+
url: url,
|
189
|
+
endpoint: endpoint
|
190
|
+
})
|
191
|
+
end
|
192
|
+
|
193
|
+
private
|
194
|
+
|
195
|
+
# adds parameters to a url, with consideration for
|
196
|
+
# already existing parameters
|
197
|
+
def add_parameters(url, params)
|
198
|
+
parsed = URI.parse(url)
|
199
|
+
query = if parsed.query
|
200
|
+
CGI.parse(parsed.query)
|
201
|
+
else
|
202
|
+
{}
|
203
|
+
end
|
204
|
+
|
205
|
+
query = query.merge(params)
|
206
|
+
|
207
|
+
parsed.query = URI.encode_www_form(query)
|
208
|
+
parsed.to_s
|
160
209
|
end
|
161
210
|
end
|
162
211
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ims-lti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -54,20 +54,20 @@ dependencies:
|
|
54
54
|
name: rspec
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '3.0'
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '3.0'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.0'
|
70
|
-
- - "
|
70
|
+
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '3.0'
|
73
73
|
description:
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.1
|
118
|
+
rubygems_version: 3.0.3.1
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Ruby library for creating IMS LTI tool providers and consumers
|