learnosity-sdk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE +201 -0
- data/README.md +269 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/examples/lrn-sdk-rails/.gitignore +21 -0
- data/examples/lrn-sdk-rails/Gemfile +57 -0
- data/examples/lrn-sdk-rails/README.md +24 -0
- data/examples/lrn-sdk-rails/Rakefile +6 -0
- data/examples/lrn-sdk-rails/app/assets/config/manifest.js +3 -0
- data/examples/lrn-sdk-rails/app/assets/images/.keep +0 -0
- data/examples/lrn-sdk-rails/app/assets/javascripts/application.js +16 -0
- data/examples/lrn-sdk-rails/app/assets/javascripts/cable.js +13 -0
- data/examples/lrn-sdk-rails/app/assets/javascripts/channels/.keep +0 -0
- data/examples/lrn-sdk-rails/app/assets/javascripts/index.coffee +3 -0
- data/examples/lrn-sdk-rails/app/assets/stylesheets/application.css +15 -0
- data/examples/lrn-sdk-rails/app/assets/stylesheets/index.scss +3 -0
- data/examples/lrn-sdk-rails/app/channels/application_cable/channel.rb +4 -0
- data/examples/lrn-sdk-rails/app/channels/application_cable/connection.rb +4 -0
- data/examples/lrn-sdk-rails/app/controllers/application_controller.rb +3 -0
- data/examples/lrn-sdk-rails/app/controllers/concerns/.keep +0 -0
- data/examples/lrn-sdk-rails/app/controllers/index_controller.rb +105 -0
- data/examples/lrn-sdk-rails/app/helpers/application_helper.rb +2 -0
- data/examples/lrn-sdk-rails/app/helpers/index_helper.rb +2 -0
- data/examples/lrn-sdk-rails/app/jobs/application_job.rb +2 -0
- data/examples/lrn-sdk-rails/app/mailers/application_mailer.rb +4 -0
- data/examples/lrn-sdk-rails/app/models/application_record.rb +3 -0
- data/examples/lrn-sdk-rails/app/models/concerns/.keep +0 -0
- data/examples/lrn-sdk-rails/app/views/index/index.html.erb +24 -0
- data/examples/lrn-sdk-rails/app/views/layouts/application.html.erb +14 -0
- data/examples/lrn-sdk-rails/app/views/layouts/mailer.html.erb +13 -0
- data/examples/lrn-sdk-rails/app/views/layouts/mailer.text.erb +1 -0
- data/examples/lrn-sdk-rails/bin/bundle +3 -0
- data/examples/lrn-sdk-rails/bin/rails +9 -0
- data/examples/lrn-sdk-rails/bin/rake +9 -0
- data/examples/lrn-sdk-rails/bin/setup +34 -0
- data/examples/lrn-sdk-rails/bin/spring +17 -0
- data/examples/lrn-sdk-rails/bin/update +29 -0
- data/examples/lrn-sdk-rails/config.ru +5 -0
- data/examples/lrn-sdk-rails/config/application.rb +15 -0
- data/examples/lrn-sdk-rails/config/boot.rb +3 -0
- data/examples/lrn-sdk-rails/config/cable.yml +9 -0
- data/examples/lrn-sdk-rails/config/database.yml +25 -0
- data/examples/lrn-sdk-rails/config/environment.rb +5 -0
- data/examples/lrn-sdk-rails/config/environments/development.rb +54 -0
- data/examples/lrn-sdk-rails/config/environments/production.rb +86 -0
- data/examples/lrn-sdk-rails/config/environments/test.rb +42 -0
- data/examples/lrn-sdk-rails/config/initializers/application_controller_renderer.rb +6 -0
- data/examples/lrn-sdk-rails/config/initializers/assets.rb +11 -0
- data/examples/lrn-sdk-rails/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/lrn-sdk-rails/config/initializers/cookies_serializer.rb +5 -0
- data/examples/lrn-sdk-rails/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/lrn-sdk-rails/config/initializers/inflections.rb +16 -0
- data/examples/lrn-sdk-rails/config/initializers/mime_types.rb +4 -0
- data/examples/lrn-sdk-rails/config/initializers/new_framework_defaults.rb +24 -0
- data/examples/lrn-sdk-rails/config/initializers/session_store.rb +3 -0
- data/examples/lrn-sdk-rails/config/initializers/wrap_parameters.rb +14 -0
- data/examples/lrn-sdk-rails/config/locales/en.yml +23 -0
- data/examples/lrn-sdk-rails/config/puma.rb +47 -0
- data/examples/lrn-sdk-rails/config/routes.rb +5 -0
- data/examples/lrn-sdk-rails/config/secrets.yml +22 -0
- data/examples/lrn-sdk-rails/config/spring.rb +6 -0
- data/examples/lrn-sdk-rails/db/seeds.rb +7 -0
- data/examples/lrn-sdk-rails/lib/assets/.keep +0 -0
- data/examples/lrn-sdk-rails/lib/tasks/.keep +0 -0
- data/examples/lrn-sdk-rails/log/.keep +0 -0
- data/examples/lrn-sdk-rails/public/404.html +67 -0
- data/examples/lrn-sdk-rails/public/422.html +67 -0
- data/examples/lrn-sdk-rails/public/500.html +66 -0
- data/examples/lrn-sdk-rails/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/lrn-sdk-rails/public/apple-touch-icon.png +0 -0
- data/examples/lrn-sdk-rails/public/favicon.ico +0 -0
- data/examples/lrn-sdk-rails/public/robots.txt +5 -0
- data/examples/lrn-sdk-rails/test/controllers/.keep +0 -0
- data/examples/lrn-sdk-rails/test/controllers/index_controller_test.rb +9 -0
- data/examples/lrn-sdk-rails/test/fixtures/.keep +0 -0
- data/examples/lrn-sdk-rails/test/fixtures/files/.keep +0 -0
- data/examples/lrn-sdk-rails/test/helpers/.keep +0 -0
- data/examples/lrn-sdk-rails/test/integration/.keep +0 -0
- data/examples/lrn-sdk-rails/test/mailers/.keep +0 -0
- data/examples/lrn-sdk-rails/test/models/.keep +0 -0
- data/examples/lrn-sdk-rails/test/test_helper.rb +10 -0
- data/examples/lrn-sdk-rails/tmp/.keep +0 -0
- data/examples/lrn-sdk-rails/vendor/assets/javascripts/.keep +0 -0
- data/examples/lrn-sdk-rails/vendor/assets/stylesheets/.keep +0 -0
- data/examples/simple/init_data.rb +34 -0
- data/examples/simple/init_items.rb +19 -0
- data/learnosity-sdk.gemspec +38 -0
- data/lib/learnosity/sdk.rb +9 -0
- data/lib/learnosity/sdk/exceptions.rb +10 -0
- data/lib/learnosity/sdk/request.rb +9 -0
- data/lib/learnosity/sdk/request/init.rb +232 -0
- data/lib/learnosity/sdk/utils.rb +4 -0
- data/lib/learnosity/sdk/version.rb +5 -0
- metadata +187 -0
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "learnosity/sdk"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*
|
16
|
+
/tmp/*
|
17
|
+
!/log/.keep
|
18
|
+
!/tmp/.keep
|
19
|
+
|
20
|
+
# Ignore Byebug command history file.
|
21
|
+
.byebug_history
|
@@ -0,0 +1,57 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) do |repo_name|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
+
"https://github.com/#{repo_name}.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
10
|
+
gem 'rails', '~> 5.0.2'
|
11
|
+
# Use sqlite3 as the database for Active Record
|
12
|
+
gem 'sqlite3'
|
13
|
+
# Use Puma as the app server
|
14
|
+
gem 'puma', '~> 3.0'
|
15
|
+
# Use SCSS for stylesheets
|
16
|
+
gem 'sass-rails', '~> 5.0'
|
17
|
+
# Use Uglifier as compressor for JavaScript assets
|
18
|
+
gem 'uglifier', '>= 1.3.0'
|
19
|
+
# Use CoffeeScript for .coffee assets and views
|
20
|
+
gem 'coffee-rails', '~> 4.2'
|
21
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
22
|
+
# gem 'therubyracer', platforms: :ruby
|
23
|
+
|
24
|
+
# Use jquery as the JavaScript library
|
25
|
+
gem 'jquery-rails'
|
26
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
27
|
+
gem 'turbolinks', '~> 5'
|
28
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
29
|
+
gem 'jbuilder', '~> 2.5'
|
30
|
+
# Use Redis adapter to run Action Cable in production
|
31
|
+
# gem 'redis', '~> 3.0'
|
32
|
+
# Use ActiveModel has_secure_password
|
33
|
+
# gem 'bcrypt', '~> 3.1.7'
|
34
|
+
|
35
|
+
# Use Capistrano for deployment
|
36
|
+
# gem 'capistrano-rails', group: :development
|
37
|
+
|
38
|
+
group :development, :test do
|
39
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
40
|
+
gem 'byebug', platform: :mri
|
41
|
+
end
|
42
|
+
|
43
|
+
group :development do
|
44
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
45
|
+
gem 'web-console', '>= 3.3.0'
|
46
|
+
gem 'listen', '~> 3.0.5'
|
47
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
48
|
+
gem 'spring'
|
49
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
53
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
54
|
+
|
55
|
+
# The :path allows us to use the local code, you'll likely not need that in a
|
56
|
+
# normal project
|
57
|
+
gem 'learnosity-sdk', :path => '../..'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'learnosity/sdk/request/init'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
class IndexController < ApplicationController
|
5
|
+
@@security_packet = {
|
6
|
+
'consumer_key' => 'yis0TYCu7U9V4o7M',
|
7
|
+
'domain' => 'localhost'
|
8
|
+
}
|
9
|
+
# XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked in in revision control
|
10
|
+
@@consumer_secret = '74c5fd430cf1242a527f6223aebd42d30464be22'
|
11
|
+
@@items_request = {
|
12
|
+
"activity_id" => "itemsassessdemo",
|
13
|
+
"assess_inline" => true,
|
14
|
+
"config" => {
|
15
|
+
"administration" => {
|
16
|
+
"options" => {"show_exit" => true, "show_extend" => true, "show_save" => true},
|
17
|
+
"pwd" => "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
|
18
|
+
},
|
19
|
+
"configuration" => {
|
20
|
+
"fontsize" => "normal",
|
21
|
+
"idle_timeout" => {"countdown_time" => 60, "interval" => 300},
|
22
|
+
"lazyload" => false,
|
23
|
+
"ondiscard_redirect_url" => "itemsapi_assess.php",
|
24
|
+
"onsave_redirect_url" => "itemsapi_assess.php",
|
25
|
+
"onsubmit_redirect_url" => "itemsapi_assess.php",
|
26
|
+
"stylesheet" => "",
|
27
|
+
"submit_criteria" => {"type" => "attempted"}
|
28
|
+
},
|
29
|
+
"ignore_question_attributes" => [""],
|
30
|
+
"labelBundle" => {
|
31
|
+
"answerMasking" => "Answer Eliminator",
|
32
|
+
"colorScheme" => "Colour Scheme",
|
33
|
+
"item" => "Question",
|
34
|
+
"paletteInstructions" => "Instructions...colour"
|
35
|
+
},
|
36
|
+
"navigation" => {
|
37
|
+
"auto_save" => {"saveIntervalDuration" => 500, "ui" => false},
|
38
|
+
"item_count" => {"question_count_option" => false},
|
39
|
+
"scroll_to_test" => false,
|
40
|
+
"scroll_to_top" => false,
|
41
|
+
"scrolling_indicator" => false,
|
42
|
+
"show_accessibility" => {
|
43
|
+
"show_colourscheme" => true,
|
44
|
+
"show_fontsize" => true,
|
45
|
+
"show_zoom" => true
|
46
|
+
},
|
47
|
+
"show_acknowledgements" => true,
|
48
|
+
"show_answermasking" => true,
|
49
|
+
"show_calculator" => false,
|
50
|
+
"show_configuration" => false,
|
51
|
+
"show_fullscreencontrol" => true,
|
52
|
+
"show_intro" => true,
|
53
|
+
"show_itemcount" => true,
|
54
|
+
"show_next" => true,
|
55
|
+
"show_outro" => true,
|
56
|
+
"show_prev" => true,
|
57
|
+
"show_progress" => true,
|
58
|
+
"show_save" => false,
|
59
|
+
"show_submit" => true,
|
60
|
+
"show_title" => true,
|
61
|
+
"skip_submit_confirmation" => false,
|
62
|
+
"toc" => true,
|
63
|
+
"transition" => "fade",
|
64
|
+
"transition_speed" => 400,
|
65
|
+
"warning_on_change" => false
|
66
|
+
},
|
67
|
+
"subtitle" => "Walter White",
|
68
|
+
"time" => {
|
69
|
+
"limit_type" => "soft",
|
70
|
+
"max_time" => 1500,
|
71
|
+
"show_pause" => true,
|
72
|
+
"show_time" => true,
|
73
|
+
"warning_time" => 120
|
74
|
+
},
|
75
|
+
"title" => "Demo activity - showcasing question types and assess options",
|
76
|
+
"ui_style" => "main"
|
77
|
+
},
|
78
|
+
"items" => [
|
79
|
+
"Demo3",
|
80
|
+
"Demo4",
|
81
|
+
"accessibility_demo_6",
|
82
|
+
"Demo6",
|
83
|
+
"Demo7",
|
84
|
+
"Demo8",
|
85
|
+
"Demo9",
|
86
|
+
"Demo10",
|
87
|
+
"audioplayer-demo-1"
|
88
|
+
],
|
89
|
+
"name" => "Items API demo - assess activity",
|
90
|
+
"rendering_type" => "assess",
|
91
|
+
"session_id" => SecureRandom.uuid,
|
92
|
+
"state" => "initial",
|
93
|
+
"type" => "submit_practice",
|
94
|
+
"user_id" => "demo_student"
|
95
|
+
}
|
96
|
+
|
97
|
+
def index
|
98
|
+
@init = Learnosity::Sdk::Request::Init.new(
|
99
|
+
'items',
|
100
|
+
@@security_packet,
|
101
|
+
@@consumer_secret,
|
102
|
+
@@items_request
|
103
|
+
)
|
104
|
+
end
|
105
|
+
end
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Index#index</h1>
|
2
|
+
|
3
|
+
<div id="learnosity_assess"></div>
|
4
|
+
|
5
|
+
<script src="//items.learnosity.com"></script>
|
6
|
+
<script>
|
7
|
+
var eventOptions = {
|
8
|
+
readyListener: init
|
9
|
+
},
|
10
|
+
itemsApp = LearnosityItems.init(<%= raw @init.generate %>);
|
11
|
+
|
12
|
+
function init () {
|
13
|
+
var assessApp = itemsApp.assessApp();
|
14
|
+
|
15
|
+
|
16
|
+
assessApp.on('item:load', function () {
|
17
|
+
console.log('Active item:', getActiveItem(this.getItems()));
|
18
|
+
});
|
19
|
+
|
20
|
+
assessApp.on('test:submit:success', function () {
|
21
|
+
toggleModalClass();
|
22
|
+
});
|
23
|
+
}
|
24
|
+
</script>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>LrnSdkRails</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|