-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_lti.rb
executable file
·48 lines (40 loc) · 1.24 KB
/
test_lti.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'sinatra/base'
require 'ims/lti'
require 'ims/lti/extensions'
require 'digest/md5'
# must include the oauth proxy object
require 'oauth/request_proxy/rack_request'
require 'pp'
require 'json'
require 'nokogiri'
require './activities/activities.rb'
require './lib/main.rb'
require './lib/samplers.rb'
require './lib/models.rb'
require './lib/grade_passback.rb'
require './lib/validation.rb'
require './lib/lesson_launch.rb'
require './lib/lessons.rb'
require './lib/api.rb'
require './lib/auth.rb'
require './lib/stats.rb'
class TestLti < Sinatra::Base
register Sinatra::Main
register Sinatra::LessonLaunch
register Sinatra::Lessons
register Sinatra::GradePassback
register Sinatra::Validation
register Sinatra::Auth
register Sinatra::Stats
# sinatra wants to set x-frame-options by default, disable it
disable :protection
enable :sessions
raise "session key required" if ENV['RACK_ENV'] == 'production' && !ENV['SESSION_KEY']
set :session_secret, ENV['SESSION_KEY'] || "local_secret"
set :method_override, true
env = ENV['RACK_ENV'] || settings.environment
DataMapper.setup(:default, (ENV["DATABASE_URL"] || "sqlite3:///#{Dir.pwd}/#{env}.sqlite3"))
DataMapper.auto_upgrade!
end
class ApiError < StandardError
end