coalescing_panda 0.0.7 → 0.0.11

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.
@@ -11,6 +11,15 @@ module CoalescingPanda
11
11
  tc = IMS::LTI::ToolConfig.new(:title => lti_options[:title], :launch_url => (lti_options[:launch_url])|| 'ABC')
12
12
  tc.set_ext_param(platform, :domain, request.host)
13
13
  tc.set_ext_param(platform, :privacy_level, 'public')
14
+
15
+ if(lti_options.has_key?(:custom_fields))
16
+ tc.set_ext_param(platform, :custom_fields, lti_options[:custom_fields])
17
+
18
+ lti_options[:custom_fields].each do |k, v|
19
+ tc.set_ext_param(platform, k, v)
20
+ end
21
+ end
22
+
14
23
  lti_nav.each do |k, v|
15
24
  tc.set_ext_param(platform, "#{k.to_s}_navigation".to_sym, ext_params(v) )
16
25
  end
@@ -21,7 +30,7 @@ module CoalescingPanda
21
30
  end
22
31
 
23
32
  private
24
-
33
+
25
34
  def ext_params(options)
26
35
  url = options.delete(:url)
27
36
  options[:url] = main_app.send(url+'_url')
@@ -61,13 +61,9 @@ module CoalescingPanda
61
61
  end
62
62
 
63
63
  def canvas_environment
64
- case request.host
65
- when /\.beta\..+\.[a-z]{2,}.*/
66
- :beta
67
- when /\.test\..+\.[a-z]{2,}.*/
64
+ case params['custom_test_environment']
65
+ when 'true'
68
66
  :test
69
- when /(localhost)|(127\.0\.0\.1).*/
70
- :dev
71
67
  else
72
68
  :production
73
69
  end
@@ -13,5 +13,12 @@ module CoalescingPanda
13
13
  initializer 'cloaescing_panda.route_helper' do |route|
14
14
  ActionDispatch::Routing::Mapper.send :include, CoalescingPanda::RouteHelpers
15
15
  end
16
+
17
+ initializer 'coalescing_panda.route_options' do |app|
18
+ ActiveSupport.on_load(:disable_dependency_loading) do
19
+ CoalescingPanda::propagate_lti_navigation
20
+ end
21
+ end
22
+
16
23
  end
17
24
  end
@@ -16,13 +16,8 @@ module CoalescingPanda
16
16
  path = "#{base_path}/#{nav.to_s}"
17
17
  lti_options[:url] = path.split('/').reject(&:empty?).join('_')
18
18
  post path, options, &block
19
+ CoalescingPanda::register_navigation(nav)
19
20
  CoalescingPanda::lti_navigation(nav, lti_options)
20
21
  end
21
-
22
- def lti_mount(app, options = nil)
23
- CoalescingPanda.lti_options = options && options.delete(:lti_options)
24
- mount(app, options)
25
- end
26
-
27
22
  end
28
23
  end
@@ -1,3 +1,3 @@
1
1
  module CoalescingPanda
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -8,6 +8,7 @@ module CoalescingPanda
8
8
  class NotMounted < StandardError;end
9
9
 
10
10
  @@lti_navigation = {}
11
+ @@staged_navigation = {}
11
12
  @@lti_options
12
13
 
13
14
  def self.lti_options= lti_options
@@ -18,13 +19,32 @@ module CoalescingPanda
18
19
  @@lti_options.deep_dup
19
20
  end
20
21
 
21
- def self.lti_navigation(navigation, options)
22
- @@lti_navigation[navigation] = options
22
+ def self.register_navigation(navigation)
23
+ @@lti_navigation[navigation] = {}
24
+ end
25
+
26
+ def self.stage_navigation(navigation, options)
27
+ @@staged_navigation[navigation] = {} unless @@staged_navigation.has_key?(navigation)
28
+ @@staged_navigation[navigation].merge!(options)
23
29
  end
24
30
 
25
31
  def self.lti_paths
26
32
  @@lti_navigation.deep_dup
27
33
  end
28
34
 
35
+ def self.propagate_lti_navigation
36
+ @@staged_navigation.each do |k,v|
37
+ lti_navigation(k,v)
38
+ @@staged_navigation.delete(k)
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def self.lti_navigation(navigation, options)
45
+ raise "lti navigation '#{navigation}' has not been registered!" unless @@lti_navigation.has_key?(navigation)
46
+ @@lti_navigation[navigation].merge!(options)
47
+ end
48
+
29
49
  end
30
50
 
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.7
4
+ version: 0.0.11
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-26 00:00:00.000000000 Z
12
+ date: 2013-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '0.3'
37
+ version: '0.4'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: '0.3'
45
+ version: '0.4'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: ims-lti
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -231,11 +231,7 @@ files:
231
231
  - spec/dummy/config/locales/en.yml
232
232
  - spec/dummy/config/routes.rb
233
233
  - spec/dummy/config.ru
234
- - spec/dummy/db/development.sqlite3
235
234
  - spec/dummy/db/schema.rb
236
- - spec/dummy/db/test.sqlite3
237
- - spec/dummy/log/development.log
238
- - spec/dummy/log/test.log
239
235
  - spec/dummy/public/404.html
240
236
  - spec/dummy/public/422.html
241
237
  - spec/dummy/public/500.html
@@ -296,11 +292,7 @@ test_files:
296
292
  - spec/dummy/config/locales/en.yml
297
293
  - spec/dummy/config/routes.rb
298
294
  - spec/dummy/config.ru
299
- - spec/dummy/db/development.sqlite3
300
295
  - spec/dummy/db/schema.rb
301
- - spec/dummy/db/test.sqlite3
302
- - spec/dummy/log/development.log
303
- - spec/dummy/log/test.log
304
296
  - spec/dummy/public/404.html
305
297
  - spec/dummy/public/422.html
306
298
  - spec/dummy/public/500.html
Binary file
Binary file
@@ -1,9 +0,0 @@
1
-  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
- Migrating to CreateCoalescingPandaCanvasApiAuths (20131114150001)
5
-  (0.0ms) begin transaction
6
-  (0.3ms) CREATE TABLE "coalescing_panda_canvas_api_auths" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" varchar(255), "api_domain" varchar(255), "api_token" varchar(255), "created_at" datetime, "updated_at" datetime) 
7
- SQL (1.4ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131114150001"]]
8
-  (0.8ms) commit transaction
9
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"