ims-lti 1.1.12 → 1.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3519a3ee6fb782c4ed97fcb89652c2011a3bb602
4
- data.tar.gz: 495e959fd7bcddd71da5ead3ec88745109aae5c6
3
+ metadata.gz: 349045d52db72ab3885b106c5874f5e6c217fed2
4
+ data.tar.gz: 3dd49abc26a739d0c313f8bdb477317a79c2598d
5
5
  SHA512:
6
- metadata.gz: a046a0db9890831af84705ca31d11d409ee3095b58e56e1bfd1eb458163a9856fbbff51bd7738d87a776d97bc7a88fc74b62980a64a8553437bb66592178499f
7
- data.tar.gz: ac7793788cb184c463f10e977dfac0f448c840f99ca4f9a11cc9bd1af6142d6896b9d1a1fa8419afd404b16c4ca6967315e38429cf0c17ccfb719e0273998371
6
+ metadata.gz: 14f47290fd89679b75b5e5b4957b08c9431e50b69632a313f89a194454b61126c8ee801b5329b246b8c64d7458698629bb289de1c66450498f20051be803506c
7
+ data.tar.gz: befc124ca8958e2912466f3a79dd8f20a9105cba6614a3bfe96d374d6dcffa2634493138a08727ef7ffc1d1a929624ee8d3b40e92cfe6f69b5d53f1f984172d0
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 2016-10-05 Version 1.1.13
2
+ * Fix Oauth::Unauthorized initialization bug
3
+ * Relax oauth dependency
4
+
1
5
  2016-06-16 Version 1.1.12
2
6
  * Add support for detecting observer role
3
7
 
data/README.md CHANGED
@@ -16,14 +16,14 @@ To require the library in your project:
16
16
  To validate the OAuth signatures you need to require the appropriate request
17
17
  proxy for your application. For example:
18
18
 
19
+ # For a Rails 5 (and 2.3) app:
20
+ require 'oauth/request_proxy/action_controller_request'
21
+
19
22
  # For a Sinatra or a Rails 3 or 4 app:
20
23
  require 'oauth/request_proxy/rack_request'
21
24
  # You also need to explicitly enable OAuth 1 support in the environment.rb or an initializer:
22
25
  OAUTH_10_SUPPORT = true
23
26
 
24
- # For a Rails 2.3 app:
25
- require 'oauth/request_proxy/action_controller_request'
26
-
27
27
  For further information see the [oauth-ruby](https://github.com/oauth-xx/oauth-ruby) project.
28
28
 
29
29
  As a quick debugging note, if you forget that step, you'll get an error like:
@@ -148,18 +148,43 @@ module IMS::LTI
148
148
  extention_process_xml(doc)
149
149
  end
150
150
 
151
+ def generate_request_xml
152
+ raise IMS::LTI::InvalidLTIConfigError, "`@operation` and `@lis_result_sourcedid` are required" unless has_request_xml_attributes?
153
+ builder = Builder::XmlMarkup.new #(:indent=>2)
154
+ builder.instruct!
155
+
156
+ builder.imsx_POXEnvelopeRequest("xmlns" => "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0") do |env|
157
+ env.imsx_POXHeader do |header|
158
+ header.imsx_POXRequestHeaderInfo do |info|
159
+ info.imsx_version "V1.0"
160
+ info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier
161
+ end
162
+ end
163
+ env.imsx_POXBody do |body|
164
+ body.tag!(@operation + 'Request') do |request|
165
+ request.resultRecord do |record|
166
+ record.sourcedGUID do |guid|
167
+ guid.sourcedId @lis_result_sourcedid
168
+ end
169
+ results(record)
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
175
+
151
176
  private
152
-
177
+
153
178
  def extention_process_xml(doc)
154
179
  end
155
-
180
+
156
181
  def has_result_data?
157
182
  !!score
158
183
  end
159
-
184
+
160
185
  def results(node)
161
186
  return unless has_result_data?
162
-
187
+
163
188
  node.result do |res|
164
189
  result_values(res)
165
190
  end
@@ -178,29 +203,8 @@ module IMS::LTI
178
203
  @consumer_key && @consumer_secret && @lis_outcome_service_url && @lis_result_sourcedid && @operation
179
204
  end
180
205
 
181
- def generate_request_xml
182
- builder = Builder::XmlMarkup.new #(:indent=>2)
183
- builder.instruct!
184
-
185
- builder.imsx_POXEnvelopeRequest("xmlns" => "http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0") do |env|
186
- env.imsx_POXHeader do |header|
187
- header.imsx_POXRequestHeaderInfo do |info|
188
- info.imsx_version "V1.0"
189
- info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier
190
- end
191
- end
192
- env.imsx_POXBody do |body|
193
- body.tag!(@operation + 'Request') do |request|
194
- request.resultRecord do |record|
195
- record.sourcedGUID do |guid|
196
- guid.sourcedId @lis_result_sourcedid
197
- end
198
- results(record)
199
- end
200
- end
201
- end
202
- end
206
+ def has_request_xml_attributes?
207
+ @operation && @lis_result_sourcedid
203
208
  end
204
-
205
209
  end
206
210
  end
@@ -18,14 +18,20 @@ module IMS::LTI
18
18
  def valid_request?(request, handle_error=true)
19
19
  begin
20
20
  @oauth_signature_validator = OAuth::Signature.build(request, :consumer_secret => @consumer_secret)
21
- @oauth_signature_validator.verify() or raise OAuth::Unauthorized
21
+ @oauth_signature_validator.verify() or raise OAuth::Unauthorized.new(request)
22
22
  true
23
- rescue OAuth::Signature::UnknownSignatureMethod, OAuth::Unauthorized
23
+ rescue OAuth::Signature::UnknownSignatureMethod
24
24
  if handle_error
25
25
  false
26
26
  else
27
27
  raise $!
28
28
  end
29
+ rescue OAuth::Unauthorized
30
+ if handle_error
31
+ false
32
+ else
33
+ raise OAuth::Unauthorized.new(request)
34
+ end
29
35
  end
30
36
  end
31
37
 
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.1.12
4
+ version: 1.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure
@@ -28,32 +28,24 @@ 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'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.4.5
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
40
  requirements:
45
41
  - - ">="
46
42
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
43
+ version: 0.4.5
44
+ - - "<"
53
45
  - !ruby/object:Gem::Version
54
- version: '0'
46
+ version: '0.6'
55
47
  - !ruby/object:Gem::Dependency
56
- name: ruby-debug
48
+ name: rspec
57
49
  requirement: !ruby/object:Gem::Requirement
58
50
  requirements:
59
51
  - - ">="
@@ -117,4 +109,3 @@ signing_key:
117
109
  specification_version: 4
118
110
  summary: Ruby library for creating IMS LTI tool providers and consumers
119
111
  test_files: []
120
- has_rdoc: