coalescing_panda 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aeb76aa967a3ed977bdc2b281f0bfa4330f332b8
4
- data.tar.gz: 3928b5b503bda777919cb5add067217912a3db77
3
+ metadata.gz: b2c34217f412e2564632c2d78755b09a08304e44
4
+ data.tar.gz: 978545da6add23c795c1b09c4c69c0a754abe522
5
5
  SHA512:
6
- metadata.gz: 89ccfe8381296e5f66618e11247feb5ee8561273a4960e5aaf8cf43c7cb6759fcd9065705edd778aef7ee6f5112ffd2c26dfdcdc6c6d2a165d16d36c07d8f84e
7
- data.tar.gz: e7592b394e5192c76c782d181045ef82711e384f586785803fe805ab91cea8617fc9fb9c12eb81dde90d0149ecba05c001e31d9bcbfe52be2f7071b5c5658437
6
+ metadata.gz: b7450485d74c088ecda1bb8cc2097ced45117934a9306c1a40c51057ea7692e5d184bf0f2b9fd53be1cfeb13f27c36e1f6293fa2dfadd801c5bc5047c131c3d2
7
+ data.tar.gz: ce217b7979c44852e093c650199a3a28f91ff6502d0a55b4f6ae367602e807eb4ddf3eaf346485280ce8400b60c035b5371ea5cf54bbdaafd0a40755345a9d10
@@ -6,6 +6,13 @@ module CoalescingPanda
6
6
  def lti_config
7
7
  lti_options = CoalescingPanda.lti_options
8
8
  lti_nav = CoalescingPanda.lti_paths
9
+ lti_environments = CoalescingPanda.lti_environments
10
+
11
+ if lti_environments.empty?
12
+ render text: 'Domains must be set in lti_environments'
13
+ return
14
+ end
15
+
9
16
  lti_nav[:course][:text] = params[:course_navigation_label] if params[:course_navigation_label].present?
10
17
  lti_nav[:account][:text] = params[:account_navigation_label] if params[:account_navigation_label].present?
11
18
  platform = 'canvas.instructure.com'
@@ -24,6 +31,8 @@ module CoalescingPanda
24
31
  tc.set_ext_param(platform, setting_name(k.to_s), ext_params(v))
25
32
  end
26
33
 
34
+ tc.set_ext_param(platform, :environments, lti_environments)
35
+
27
36
  #strip the launch url
28
37
  xml = tc.to_xml
29
38
  xml = xml.sub(/<blti:launch_url>.*<\/blti:launch_url>/, '') if lti_options[:launch_route].blank?
@@ -60,4 +69,4 @@ module CoalescingPanda
60
69
  end
61
70
 
62
71
  end
63
- end
72
+ end
@@ -74,7 +74,7 @@ module CoalescingPanda
74
74
  end
75
75
 
76
76
  def have_session?
77
- if params['oauth_consumer_key'] && session['user_id'] != params['user_id']
77
+ if params['tool_consumer_instance_guid'] && session['user_id'] != params['user_id']
78
78
  reset_session
79
79
  logger.info("resetting session params")
80
80
  session['user_id'] = params['user_id']
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = '1.2.2'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -15,6 +15,7 @@ module CoalescingPanda
15
15
  @@lti_navigation = {}
16
16
  @@staged_navigation = {}
17
17
  @@lti_options = {}
18
+ @@lti_environments = {}
18
19
 
19
20
  def self.lti_options= lti_options
20
21
  @@lti_options = lti_options
@@ -24,6 +25,14 @@ module CoalescingPanda
24
25
  @@lti_options.deep_dup
25
26
  end
26
27
 
28
+ def self.lti_environments=(lti_environments)
29
+ @@lti_environments = lti_environments
30
+ end
31
+
32
+ def self.lti_environments
33
+ @@lti_environments.deep_dup
34
+ end
35
+
27
36
  def self.register_navigation(navigation)
28
37
  @@lti_navigation[navigation] ||= {}
29
38
  end
@@ -4,6 +4,10 @@ describe CoalescingPanda::LtiController, type: :controller do
4
4
  routes { CoalescingPanda::Engine.routes }
5
5
 
6
6
  describe '#lti_config' do
7
+ before :each do
8
+ CoalescingPanda.class_variable_set(:@@lti_navigation, {})
9
+ CoalescingPanda.lti_environments = { test_domain: 'test' }
10
+ end
7
11
 
8
12
  it 'generates lti xml config'do
9
13
  controller.main_app.stub(:test_action_url) {'foo'}
@@ -31,8 +35,14 @@ describe CoalescingPanda::LtiController, type: :controller do
31
35
  account_nav.at_xpath('lticm:property[@name="url"]').text.should == 'foo'
32
36
  end
33
37
 
34
- end
38
+ it 'includes environment information' do
39
+ get(:lti_config)
40
+ xml = Nokogiri::XML(response.body)
41
+ environments = xml.at_xpath('//lticm:options[@name="environments"]')
42
+ environments.at_xpath('lticm:property[@name="test_domain"]').text.should == 'test'
43
+ end
35
44
 
45
+ end
36
46
 
37
47
  it 'get the url, from the action string' do
38
48
  controller.main_app.stub(:test_action_url) {'foo'}
@@ -40,5 +50,4 @@ describe CoalescingPanda::LtiController, type: :controller do
40
50
  options[:url].should == 'foo'
41
51
  end
42
52
 
43
-
44
53
  end