coalescing_panda 0.0.1 → 0.0.2

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.
@@ -27,7 +27,7 @@ module CoalescingPanda
27
27
  @tp = IMS::LTI::ToolProvider.new(@lti_account.key, @lti_account.secret, params)
28
28
  authorized = @tp.valid_request?(request)
29
29
  end
30
- authorized = authorized && (roles == 0 || (roles && lti_roles).count > 1)
30
+ authorized = authorized && (roles == 0 || (roles && lti_roles).count > 0)
31
31
  authorized = authorized && @lti_account.validate_nonce(params['oauth_nonce'], DateTime.strptime(params['oauth_timestamp'],'%s'))
32
32
  if !authorized
33
33
  render :text => 'Invalid Credentials, please contact your Administrator.', :status => :unauthorized
@@ -57,5 +57,20 @@ module CoalescingPanda
57
57
  }.uniq
58
58
  end
59
59
 
60
+ def canvas_environment
61
+ case request.host
62
+ when /\.beta\..+\.[a-z]{2,}.*/
63
+ :beta
64
+ when /\.test\..+\.[a-z]{2,}.*/
65
+ :test
66
+ when /(localhost)|(127\.0\.0\.1).*/
67
+ :dev
68
+ when /https:\/\/.*/
69
+ :production
70
+ else
71
+ :unknown
72
+ end
73
+ end
74
+
60
75
  end
61
76
  end
@@ -1,6 +1,6 @@
1
1
  module CoalescingPanda
2
2
  class Engine < ::Rails::Engine
3
- config.autoload_paths += Dir["#{config.root}/lib/**/"]
3
+ config.autoload_once_paths += Dir["#{config.root}/lib/**/"]
4
4
  isolate_namespace CoalescingPanda
5
5
 
6
6
  initializer 'coalescing_panda.app_controller' do |app|
@@ -15,8 +15,8 @@ module CoalescingPanda
15
15
  lti_options = options.delete(:lti_options) || {}
16
16
  path = "#{base_path}/#{nav.to_s}"
17
17
  lti_options[:url] = path.split('/').reject(&:empty?).join('_')
18
- CoalescingPanda::lti_navigation(nav, lti_options)
19
18
  post path, options, &block
19
+ CoalescingPanda::lti_navigation(nav, lti_options)
20
20
  end
21
21
 
22
22
  def lti_mount(app, options = nil)
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -19,7 +19,6 @@ module CoalescingPanda
19
19
  end
20
20
 
21
21
  def self.lti_navigation(navigation, options)
22
- raise LtiNavigationInUse.new("#{navigation} can only be defined once") if @@lti_navigation.has_key?(navigation)
23
22
  @@lti_navigation[navigation] = options
24
23
  end
25
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coalescing_panda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-19 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails