ims-lti 1.1.13 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +3 -0
- data/README.md +1 -1
- data/lib/ims/lti.rb +6 -2
- data/lib/ims/lti/deprecated_role_checks.rb +1 -1
- data/lib/ims/lti/launch_params.rb +1 -1
- data/lib/ims/lti/outcome_response.rb +7 -3
- data/lib/ims/lti/role_checks.rb +2 -2
- metadata +4 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3235b72aa7a7f01032b0e5a4e6f41291ef9fd8dc
|
4
|
+
data.tar.gz: 6fe9dd358c230756b798ede1317647fa0dfe5fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a533acf2b2051cc3ec55e9f2a1851ee008a64d2e595661f839d8e7528231d91d3e88aa4f313a1719adf9660c6a65df5515be1834cff1e2730dd0e48815f15dac
|
7
|
+
data.tar.gz: b6baa3a683f85d810bee49ccc79b07c9a535390e56eeec4fad4865fd35ca0f2c6c32283b159058e11c012b6f65681f359ed0cc351601850fa7ac336caed8f783
|
data/Changelog
CHANGED
data/README.md
CHANGED
@@ -52,7 +52,7 @@ and it will be signed with OAuth using a key/secret that both the TP and TC shar
|
|
52
52
|
This is covered in the [LTI security model](http://www.imsglobal.org/LTI/v1p1/ltiIMGv1p1.html#_Toc319560466)
|
53
53
|
|
54
54
|
Here is an example of a simple TP Sinatra app using this gem:
|
55
|
-
[LTI Tool Provider](https://github.com/instructure/
|
55
|
+
[LTI Tool Provider](https://github.com/instructure/lti1_tool_provider_example)
|
56
56
|
|
57
57
|
Once you find the `oauth_consumer_secret` based on the `oauth_consumer_key` in
|
58
58
|
the request, you can initialize a `ToolProvider` object with them and the post parameters:
|
data/lib/ims/lti.rb
CHANGED
@@ -2,6 +2,7 @@ require 'oauth'
|
|
2
2
|
require 'builder'
|
3
3
|
require "rexml/document"
|
4
4
|
require 'cgi'
|
5
|
+
require 'securerandom'
|
5
6
|
|
6
7
|
module IMS # :nodoc:
|
7
8
|
|
@@ -25,13 +26,16 @@ module IMS # :nodoc:
|
|
25
26
|
#
|
26
27
|
# require 'ims/lti'
|
27
28
|
module LTI
|
28
|
-
|
29
|
+
|
29
30
|
# The versions of LTI this library supports
|
30
31
|
VERSIONS = %w{1.0 1.1}
|
31
|
-
|
32
|
+
|
32
33
|
class InvalidLTIConfigError < StandardError
|
33
34
|
end
|
34
35
|
|
36
|
+
class XMLParseError < StandardError
|
37
|
+
end
|
38
|
+
|
35
39
|
# POST a signed oauth request with the given key/secret/data
|
36
40
|
def self.post_service_request(key, secret, url, content_type, body)
|
37
41
|
raise IMS::LTI::InvalidLTIConfigError, "" unless key && secret
|
@@ -6,7 +6,7 @@ module DeprecatedRoleChecks
|
|
6
6
|
# Check whether the Launch Parameters have a role
|
7
7
|
def has_role?(role)
|
8
8
|
role = role.downcase
|
9
|
-
@roles && @roles.any?{|r| r.index(role)}
|
9
|
+
@roles && @roles.any?{|r| r.downcase.index(role)}
|
10
10
|
end
|
11
11
|
|
12
12
|
# Convenience method for checking if the user has 'learner' or 'student' role
|
@@ -46,7 +46,7 @@ module IMS::LTI
|
|
46
46
|
#
|
47
47
|
class OutcomeResponse
|
48
48
|
include IMS::LTI::Extensions::Base
|
49
|
-
|
49
|
+
|
50
50
|
attr_accessor :request_type, :score, :message_identifier, :response_code,
|
51
51
|
:post_response, :code_major, :severity, :description, :operation,
|
52
52
|
:message_ref_identifier
|
@@ -70,7 +70,7 @@ module IMS::LTI
|
|
70
70
|
response = OutcomeResponse.new
|
71
71
|
response.process_post_response(post_response)
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def process_post_response(post_response)
|
75
75
|
self.post_response = post_response
|
76
76
|
self.response_code = post_response.code
|
@@ -105,7 +105,11 @@ module IMS::LTI
|
|
105
105
|
|
106
106
|
# Parse Outcome Response data from XML
|
107
107
|
def process_xml(xml)
|
108
|
-
|
108
|
+
begin
|
109
|
+
doc = REXML::Document.new xml
|
110
|
+
rescue => e
|
111
|
+
raise IMS::LTI::XMLParseError, "#{e}\nOriginal xml: '#{xml}'"
|
112
|
+
end
|
109
113
|
@message_identifier = doc.text("//imsx_statusInfo/imsx_messageIdentifier").to_s
|
110
114
|
@code_major = doc.text("//imsx_statusInfo/imsx_codeMajor")
|
111
115
|
@code_major.downcase! if @code_major
|
data/lib/ims/lti/role_checks.rb
CHANGED
@@ -16,7 +16,7 @@ module IMS::LTI
|
|
16
16
|
# Check whether the Launch Parameters have a given role
|
17
17
|
def has_exact_role?(role)
|
18
18
|
role = role.downcase
|
19
|
-
@roles && @roles.any? { |r| r == role }
|
19
|
+
@roles && @roles.any? { |r| r.downcase == role }
|
20
20
|
end
|
21
21
|
|
22
22
|
# Check whether the Launch Parameters have a given role ignoring
|
@@ -25,7 +25,7 @@ module IMS::LTI
|
|
25
25
|
# will return true if the role is `urn:lti:role:ims/lis/Instructor/GuestInstructor`
|
26
26
|
def has_base_role?(role)
|
27
27
|
role = role.downcase
|
28
|
-
@roles && @roles.any? { |r| r.start_with?(role) }
|
28
|
+
@roles && @roles.any? { |r| r.downcase.start_with?(role) }
|
29
29
|
end
|
30
30
|
|
31
31
|
# Convenience method for checking if the user is the system administrator of the TC
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ims-lti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure
|
@@ -28,22 +28,16 @@ dependencies:
|
|
28
28
|
name: oauth
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.4.5
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '0.6'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
|
-
- -
|
38
|
+
- - '='
|
42
39
|
- !ruby/object:Gem::Version
|
43
40
|
version: 0.4.5
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0.6'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: rspec
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
98
|
version: '0'
|
105
99
|
requirements: []
|
106
100
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.5.
|
101
|
+
rubygems_version: 2.5.2
|
108
102
|
signing_key:
|
109
103
|
specification_version: 4
|
110
104
|
summary: Ruby library for creating IMS LTI tool providers and consumers
|