lti_box_engine 0.0.1 → 0.0.2

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: ed29d85473c8108733a7065619550a82516a9772
4
- data.tar.gz: d675c633ca88b0f96566dc4eac7ee909eac61d49
3
+ metadata.gz: d5b156050f3d43dd07b1a3b0991bb9e9bc3893cc
4
+ data.tar.gz: 675d50f7462549991286013a64171b5b03e78ece
5
5
  SHA512:
6
- metadata.gz: 40cc43a14e1bb6eb1370b3e00c4e045e36f01cc6f3c2a42b3dc00ef4bb01a45765250961c335416e745dfcd0b1f415e48f2ecb9c2fab986fadeb439e5a143133
7
- data.tar.gz: 2cf411615056fc78f45bb7dd5252f79404cf63b670498f714df306b309f5184b11c523f21865847adf22a9d1606e69ab910faaf551969add0936ae9d24a03891
6
+ metadata.gz: 56a803d732a6dc991300059185eb080780c97dfe98fc61fa21ab2b46adadf169f093de9391feec4a4aff81f85228fc5efedfa838092be54458909453c53cde73
7
+ data.tar.gz: f8dd5f8e3dbe34982d08ab2a6dfe99cfdd0b621409d627b6ff391edca366e45ed7664dbb08abde353840b083ff9ada52392228c8117a4a9944b7cc5d2fb1226b
@@ -0,0 +1,4 @@
1
+ module LtiBoxEngine
2
+ class BoxOauthController < ActionController::Base
3
+ end
4
+ end
@@ -19,6 +19,11 @@ module LtiBoxEngine
19
19
  payload: tp.to_params
20
20
  })
21
21
  end
22
+
23
+ def get_user_for_lti_launch(tp)
24
+ User.where(lti_id: tp.user_id, tool_consumer_instance_guid: tp.tool_consumer_instance_guid)
25
+ end
26
+
22
27
  end
23
28
  end
24
29
  end
@@ -0,0 +1,22 @@
1
+ module LtiBoxEngine
2
+ class User < ActiveRecord::Base
3
+ def box_oauth_authorize_url
4
+ self.update_attributes(box_oauth_state: SecureRandom.uuid)
5
+ URI::HTTPS.build(
6
+ host: 'www.box.com',
7
+ path: '/api/oauth2/authorize',
8
+ query: {
9
+ response_type: 'code',
10
+ client_id: BOX_CONFIG[:client_id],
11
+ redirect_uri: BOX_CONFIG[:redirect_uri],
12
+ state: self.box_oauth_state
13
+ }.to_query
14
+ ).to_s
15
+ end
16
+
17
+ def self.get_user_for_lti_launch(tp)
18
+ User.where(lti_id: tp.user_id, tool_consumer_instance_guid: tp.tool_consumer_instance_guid)
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module LtiBoxEngine
2
+ BOX_CONFIG = YAML.load(File.read("#{Rails.root}/config/box.yml"))[Rails.env].symbolize_keys
3
+ end
@@ -0,0 +1,9 @@
1
+ class CreateUser < ActiveRecord::Migration
2
+ def change
3
+ create_table :lti_box_engine_users do |t|
4
+ t.string :tool_consumer_instance_guid
5
+ t.string :lti_id
6
+ t.string :box_oauth_state
7
+ end
8
+ end
9
+ end
@@ -5,5 +5,13 @@ module LtiBoxEngine
5
5
  config.generators do |g|
6
6
  g.test_framework :rspec
7
7
  end
8
+
9
+ initializer :append_migrations do |app|
10
+ unless app.root.to_s == root.to_s
11
+ config.paths["db/migrate"].expanded.each do |expanded_path|
12
+ app.config.paths["db/migrate"] << expanded_path
13
+ end
14
+ end
15
+ end
8
16
  end
9
17
  end
@@ -1,3 +1,3 @@
1
1
  module LtiBoxEngine
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lti_box_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Humphrey
@@ -140,19 +140,23 @@ files:
140
140
  - app/assets/javascripts/lti_box_engine/test.js
141
141
  - app/assets/stylesheets/lti_box_engine/application.scss
142
142
  - app/controllers/lti_box_engine/application_controller.rb
143
+ - app/controllers/lti_box_engine/box_oauth_controller.rb
143
144
  - app/controllers/lti_box_engine/lti_controller.rb
144
145
  - app/controllers/lti_box_engine/test_controller.rb
145
146
  - app/helpers/lti_box_engine/application_helper.rb
146
147
  - app/helpers/lti_box_engine/lti_helper.rb
147
148
  - app/helpers/lti_box_engine/test_helper.rb
148
149
  - app/models/lti_box_engine/lti_launch.rb
150
+ - app/models/lti_box_engine/user.rb
149
151
  - app/views/layouts/lti_box_engine/application.html.erb
150
152
  - app/views/lti_box_engine/lti/embed.html.erb
151
153
  - app/views/lti_box_engine/lti/error.html.erb
152
154
  - app/views/lti_box_engine/lti/index.html.erb
153
155
  - app/views/lti_box_engine/test/backdoor.html.erb
156
+ - config/initializers/box.rb
154
157
  - config/routes.rb
155
158
  - db/migrate/20140401155717_create_lti_box_engine_lti_launches.rb
159
+ - db/migrate/20140402222507_create_user.rb
156
160
  - lib/lti_box_engine.rb
157
161
  - lib/lti_box_engine/client.rb
158
162
  - lib/lti_box_engine/engine.rb
@@ -183,4 +187,3 @@ signing_key:
183
187
  specification_version: 4
184
188
  summary: Box.net LTI Application
185
189
  test_files: []
186
- has_rdoc: