learnosity-sdk 0.2.2 → 0.4.0

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.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -2
  3. data/CONTRIBUTING.md +13 -1
  4. data/ChangeLog.md +32 -0
  5. data/README.md +8 -1
  6. data/REFERENCE.md +65 -5
  7. data/docs/quickstart/lrn-sdk-rails/Gemfile +15 -14
  8. data/docs/quickstart/lrn-sdk-rails/app/controllers/author_controller.rb +2 -2
  9. data/docs/quickstart/lrn-sdk-rails/app/controllers/authoraide_controller.rb +32 -0
  10. data/docs/quickstart/lrn-sdk-rails/app/controllers/data_api_controller.rb +156 -0
  11. data/docs/quickstart/lrn-sdk-rails/app/controllers/index_controller.rb +1 -1
  12. data/docs/quickstart/lrn-sdk-rails/app/controllers/items_controller.rb +3 -3
  13. data/docs/quickstart/lrn-sdk-rails/app/controllers/questions_controller.rb +2 -2
  14. data/docs/quickstart/lrn-sdk-rails/app/controllers/reports_controller.rb +4 -4
  15. data/docs/quickstart/lrn-sdk-rails/app/views/authoraide/index.html.erb +6 -0
  16. data/docs/quickstart/lrn-sdk-rails/app/views/data_api/index.html.erb +277 -0
  17. data/docs/quickstart/lrn-sdk-rails/app/views/index/index.html.erb +8 -0
  18. data/docs/quickstart/lrn-sdk-rails/config/boot.rb +4 -0
  19. data/docs/quickstart/lrn-sdk-rails/config/initializers/new_framework_defaults.rb +2 -1
  20. data/docs/quickstart/lrn-sdk-rails/config/routes.rb +2 -0
  21. data/examples/simple/data_api_example.rb +82 -0
  22. data/examples/simple/uuid_example.rb +29 -0
  23. data/lib/learnosity/sdk/request/data_api.rb +196 -0
  24. data/lib/learnosity/sdk/request/init.rb +3 -3
  25. data/lib/learnosity/sdk/utils/uuid.rb +21 -0
  26. data/lib/learnosity/sdk/version.rb +1 -1
  27. data/lib/learnosity/sdk.rb +7 -1
  28. metadata +15 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1b27ed22a689e2e1f36aa33f042acb3562919089628503575ad67a2b919c4a8
4
- data.tar.gz: a35af7e9fa7b838322f7751efe2f942e9599a785fece6813e475bd9c9b4cac54
3
+ metadata.gz: 3f6ae3d63eaf2bc30203e980a98b7636cefb5e760a9decf38b6b2f41650b8158
4
+ data.tar.gz: 94bdb3fa2b8bad774f4b06709aa89aba682c02ea871d28b51e3b02568ad11981
5
5
  SHA512:
6
- metadata.gz: a5ed2d8fc9dba2277ca2232b9d8d5fb30bd38cd2d6bd3b4fee732e09981f7df3f2fc3600a16b1324c4d5c49c5734b82fa2615fbe28faf7224b5373f8d11618a2
7
- data.tar.gz: d3fbaa32870101f42837bc38d5fceeca2acaab7d3228e618de349b8ca9f4dbf79de8f15794cdc9c59dae8ad601a094662c02ea5d814a83d797a024b0feb61405
6
+ metadata.gz: 7d9de43a26ce21bf8dc476357ecf35149ad4145836e83458575451b47e86eb1e28417fe4a5709f018afc58b8cd569e70a235006e014deba40a9d9d49ec04ab7d
7
+ data.tar.gz: 60d57e9e7366fd2809b0c82029f1a3583918abbb45deb0c259165b23a8d9c7f244c8bfee873fb8f91d0c9de67be20c95090e877a9a0af3912dc7a1c7323f7acb
data/.travis.yml CHANGED
@@ -2,10 +2,9 @@ sudo: false
2
2
  dist: focal
3
3
  language: ruby
4
4
  rvm:
5
- - '2.6'
6
- - '2.7'
7
5
  - '3.0'
8
6
  - '3.1'
7
+ - '3.2'
9
8
  before_install:
10
9
  # Login to docker hub
11
10
  - echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
data/CONTRIBUTING.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Contributing
2
2
 
3
- Contribution in the form of [Issues] and [PRs] are welcome.
3
+ Contribution in the form of [PRs] are welcome.
4
+
5
+ ## Why We Are No Longer Accepting Public Issues
6
+ After careful consideration, we’ve decided to discontinue accepting issues via GitHub Issues for our public repositories.
7
+
8
+ Here’s why:
9
+
10
+ - We have established support channels specifically designed to handle customer inquiries and issues.
11
+ - These channels are staffed 24/7, and we work diligently to ensure prompt responses and high-quality support.
12
+ - Maintaining and responding to GitHub Issues requires significant resources, and we are unable to provide the same level of support through this channel as we do through our dedicated support teams.
13
+ - By focusing on our dedicated support channels, we can streamline our processes and offer a more effective and responsive service to our users.
14
+
15
+ For any issues or support needs, please use the existing support channels. This will help us provide you with the best possible assistance in a timely manner.
4
16
 
5
17
  ## Testing
6
18
 
data/ChangeLog.md CHANGED
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v0.4.0] - 2026-01-07
11
+
12
+ ### Added
13
+
14
+ - UUID generation utility (`Learnosity::Sdk::Uuid.generate()`) for feature parity with Python and Node.js SDKs
15
+ - Data API support with dedicated `DataApi` class
16
+ - `request()` method for single authenticated Data API requests
17
+ - `request_iter()` method for iterating through paginated responses
18
+ - `results_iter()` method for iterating through individual results across pages
19
+ - Automatic routing metadata headers: `X-Learnosity-Consumer`, `X-Learnosity-Action`, `X-Learnosity-SDK`
20
+ - HTTP timeout configurations (15s open timeout, 60s read timeout)
21
+ - Data API demo added to Rails quickstart application
22
+ - Comprehensive unit and integration tests for Data API functionality
23
+ - Example usage in `examples/simple/data_api_example.rb`
24
+
25
+ ### Changed
26
+
27
+ - Updated documentation and examples to use `Learnosity::Sdk::Uuid.generate` instead of `SecureRandom.uuid`
28
+ - Improved error handling in Data API controller with detailed error messages and backtraces
29
+
30
+ ### Fixed
31
+
32
+ - Ruby 2.6 compatibility in Rails quickstart (commented out `spring` gems that require Ruby 2.7+)
33
+ - Rails 6.1 compatibility with Ruby 2.6 (added `require 'logger'` to `config/boot.rb`)
34
+ - Bumped 3rd party libraries to fix known vulnerabilities in the quick start application
35
+ - Fixed seed data for the api-reports example in the quick start application
36
+ - Code quality improvements addressing Codacy findings
37
+
38
+ ## [v0.3.0] - 2024-07-12
39
+ ### Added
40
+ - Add support for api-authoraide.
41
+
10
42
  ## [v0.2.2] - 2023-06-29
11
43
  ### Security
12
44
  - Upgraded signature to match the security standard.
data/README.md CHANGED
@@ -98,6 +98,9 @@ For production use, you should install the SDK using the RubyGems package manage
98
98
  Let's take a look at a simple example of the SDK in action. In this example, we'll load an assessment into the browser.
99
99
 
100
100
  ### **Start up your web server and view the standalone assessment example**
101
+
102
+ **Note:** The Rails quickstart supports Ruby 2.6+. The `spring` and `spring-watcher-listen` gems are commented out in the Gemfile for Ruby 2.6 compatibility. If you're using Ruby 2.7+, you can uncomment these gems for faster development reloading.
103
+
101
104
  To start up your Ruby web server, first find the following folder location under the SDK. Change directory ('cd') to this location on the command line.
102
105
 
103
106
  ``` bash
@@ -107,6 +110,7 @@ To start up your Ruby web server, first find the following folder location under
107
110
  To start, run this command from that folder:
108
111
 
109
112
  ``` bash
113
+ bundle install
110
114
  rails server
111
115
  ```
112
116
 
@@ -143,7 +147,7 @@ We start by including some LearnositySDK helpers in [items_controller.rb](docs/q
143
147
 
144
148
  ``` ruby
145
149
  require 'learnosity/sdk/request/init' # Learnosity helper.
146
- require 'securerandom' # Library for generating UUIDs.
150
+ require 'learnosity/sdk' # For UUID generation utility.
147
151
  ```
148
152
 
149
153
  Now we'll declare the configuration options for Items API. The following options specify which assessment content should be rendered, how it should be displayed, which user is taking this assessment and how their responses should be stored.
@@ -277,6 +281,9 @@ Take a look at some more in-depth options and tutorials on using Learnosity asse
277
281
  ### **SDK reference**
278
282
  See a more detailed breakdown of all the SDK features, and examples of how to use more advanced or specialised features on the [SDK reference page](REFERENCE.md).
279
283
 
284
+ ### **Data API support**
285
+ The SDK now includes comprehensive Data API support with automatic request signing, routing metadata headers, and pagination support. See the [Data API documentation](docs/DataApi.md) for detailed usage examples and API reference.
286
+
280
287
  ### **Additional quick start guides**
281
288
  There are more quick start guides, going beyond the initial quick start topic of loading an assessment, these further tutorials show how to set up authoring and analytics:
282
289
 
data/REFERENCE.md CHANGED
@@ -106,16 +106,67 @@ request = init.generate
106
106
  Net::HTTP.post_form URI('https://data.learnosity.com/v1/itembank/items'), request
107
107
  ```
108
108
 
109
- ### Recursive Queries
109
+ ### DataApi Class (Recommended)
110
110
 
111
- tl;dr: not currently implemented
111
+ The SDK now includes a dedicated `DataApi` class that provides a more convenient way to interact with the Data API, including automatic pagination support, routing metadata headers, and simplified request handling.
112
+
113
+ ```ruby
114
+ require 'learnosity/sdk/request/data_api'
115
+
116
+ # Initialize DataApi
117
+ data_api = Learnosity::Sdk::Request::DataApi.new(
118
+ consumer_key: 'your_consumer_key',
119
+ consumer_secret: 'your_consumer_secret',
120
+ domain: 'yourdomain.com'
121
+ )
122
+
123
+ security_packet = {
124
+ 'consumer_key' => 'your_consumer_key',
125
+ 'domain' => 'yourdomain.com'
126
+ }
127
+
128
+ # Make a single request
129
+ response = data_api.request(
130
+ 'https://data.learnosity.com/v1/itembank/items',
131
+ security_packet,
132
+ 'your_consumer_secret',
133
+ { 'limit' => 10 },
134
+ 'get'
135
+ )
136
+
137
+ # Iterate through all pages automatically
138
+ data_api.request_iter(
139
+ 'https://data.learnosity.com/v1/itembank/items',
140
+ security_packet,
141
+ 'your_consumer_secret',
142
+ { 'limit' => 100 },
143
+ 'get'
144
+ ).each do |page|
145
+ puts "Page has #{page['data'].length} items"
146
+ end
147
+
148
+ # Iterate through individual results
149
+ data_api.results_iter(
150
+ 'https://data.learnosity.com/v1/itembank/items',
151
+ security_packet,
152
+ 'your_consumer_secret',
153
+ { 'limit' => 100 },
154
+ 'get'
155
+ ).each do |item|
156
+ puts "Item: #{item['reference']}"
157
+ end
158
+ ```
159
+
160
+ See the [Data API documentation](docs/DataApi.md) for more details and examples.
161
+
162
+ ### Recursive Queries (Legacy Approach)
112
163
 
113
164
  Some requests are paginated to the `limit` passed in the request, or some
114
165
  server-side default. Responses to those requests contain a `next` parameter in
115
166
  their `meta` property, which can be placed in the next request to access another
116
167
  page of data.
117
168
 
118
- For the time being, you can iterate through pages by looping over the
169
+ You can iterate through pages by looping over the
119
170
  `Init#new`/`Init#generate`/`Net::HTTP#post_form`, updating the `next` attribute
120
171
  in the request.
121
172
 
@@ -129,12 +180,21 @@ end
129
180
 
130
181
  This will `require 'json'` to be able to parse the response.
131
182
 
183
+ **Note:** The new `DataApi` class (see above) handles pagination automatically and is the recommended approach.
184
+
132
185
  See `examples/simple/init_data.rb` for an example.
133
186
 
134
187
  ### Generating UUIDs
135
188
 
136
- You will need to generate UUIDs. You can use the Ruby `securerandom`
137
- module for this purpose.
189
+ You will need to generate UUIDs for user IDs and session IDs. The SDK provides a convenient utility for this purpose.
190
+
191
+ ```ruby
192
+ require 'learnosity/sdk'
193
+
194
+ p Learnosity::Sdk::Uuid.generate
195
+ ```
196
+
197
+ Alternatively, you can use the Ruby `securerandom` module directly:
138
198
 
139
199
  ```ruby
140
200
  require 'securerandom'
@@ -5,30 +5,29 @@ git_source(:github) do |repo_name|
5
5
  "https://github.com/#{repo_name}.git"
6
6
  end
7
7
 
8
-
9
8
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10
- gem 'rails', '~> 5.0.2'
9
+ gem 'rails', '~> 6.1.0'
11
10
  # Use sqlite3 as the database for Active Record
12
- gem 'sqlite3', '~> 1.3.6'
11
+ gem 'sqlite3', '~> 1.6.3'
13
12
  # Use Puma as the app server
14
- gem 'puma', '~> 4.3.8'
13
+ gem 'puma', '~> 6.4.0'
15
14
  # Use SCSS for stylesheets
16
- gem 'sass-rails', '~> 5.0'
15
+ gem 'sass-rails', '~> 5.1.0'
17
16
  # Use Uglifier as compressor for JavaScript assets
18
- gem 'uglifier', '>= 1.3.0'
17
+ gem 'uglifier', '>= 4.2.0'
19
18
  # Use CoffeeScript for .coffee assets and views
20
- gem 'coffee-rails', '~> 4.2'
19
+ gem 'coffee-rails', '~> 5.0'
21
20
  # See https://github.com/rails/execjs#readme for more supported runtimes
22
- # gem 'therubyracer', platforms: :ruby
21
+ # gem 'mini_racer', platforms: :ruby
23
22
 
24
23
  # Use jquery as the JavaScript library
25
24
  gem 'jquery-rails'
26
25
  # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
27
26
  gem 'turbolinks', '~> 5'
28
27
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
29
- gem 'jbuilder', '~> 2.5'
28
+ gem 'jbuilder', '~> 2.11'
30
29
  # Use Redis adapter to run Action Cable in production
31
- # gem 'redis', '~> 3.0'
30
+ # gem 'redis', '~> 4.0'
32
31
  # Use ActiveModel has_secure_password
33
32
  # gem 'bcrypt', '~> 3.1.7'
34
33
 
@@ -42,11 +41,13 @@ end
42
41
 
43
42
  group :development do
44
43
  # 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'
44
+ gem 'web-console', '>= 4.2.0'
45
+ gem 'listen', '~> 3.8'
47
46
  # 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'
47
+ # Note: spring-watcher-listen requires Ruby >= 2.7.0, so it's commented out for Ruby 2.6 compatibility
48
+ # If you're using Ruby 2.7+, you can uncomment these lines for faster development reloading:
49
+ # gem 'spring'
50
+ # gem 'spring-watcher-listen', '~> 2.1.0'
50
51
  end
51
52
 
52
53
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
@@ -1,5 +1,5 @@
1
1
  require 'learnosity/sdk/request/init' # Learnosity helper.
2
- require 'securerandom'
2
+ require 'learnosity/sdk' # For UUID generation utility.
3
3
 
4
4
  class AuthorController < ApplicationController
5
5
 
@@ -7,7 +7,7 @@ class AuthorController < ApplicationController
7
7
  # XXX: This is a Learnosity Demos consumer; replace it with your own consumer key. Set values in application.rb.
8
8
  'consumer_key' => Rails.configuration.consumer_key,
9
9
  'domain' => 'localhost',
10
- 'user_id' => SecureRandom.uuid
10
+ 'user_id' => Learnosity::Sdk::Uuid.generate
11
11
  }
12
12
 
13
13
  # XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked into version control
@@ -0,0 +1,32 @@
1
+ require 'learnosity/sdk/request/init' # Learnosity helper.
2
+ require 'securerandom'
3
+
4
+ class AuthoraideController < ApplicationController
5
+
6
+ @@security_packet = {
7
+ # XXX: This is a Learnosity Demos consumer; replace it with your own consumer key. Set values in application.rb.
8
+ 'consumer_key' => Rails.configuration.consumer_key,
9
+ 'domain' => 'localhost',
10
+ }
11
+
12
+ # XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked into version control
13
+ @@consumer_secret = Rails.configuration.consumer_secret
14
+
15
+ @@authoraide_request = {
16
+ "user"=> {
17
+ "id" => "brianmoser",
18
+ "firstname" => "Test",
19
+ "lastname" => "Test",
20
+ "email" => "test@test.com"
21
+ }
22
+ }
23
+
24
+ def index
25
+ @init = Learnosity::Sdk::Request::Init.new(
26
+ 'authoraide',
27
+ @@security_packet,
28
+ @@consumer_secret,
29
+ @@authoraide_request
30
+ )
31
+ end
32
+ end
@@ -0,0 +1,156 @@
1
+ require 'learnosity/sdk/request/data_api'
2
+ require 'json'
3
+
4
+ class DataApiController < ApplicationController
5
+ # rubocop:disable Metrics/CyclomaticComplexity
6
+ # Note: This is a demo/quickstart controller that intentionally demonstrates
7
+ # three different Data API usage patterns (manual iteration, page iteration,
8
+ # and results iteration) with comprehensive error handling for educational purposes.
9
+ def index
10
+ # Initialize DataApi
11
+ data_api = Learnosity::Sdk::Request::DataApi.new(
12
+ consumer_key: Rails.configuration.consumer_key,
13
+ consumer_secret: Rails.configuration.consumer_secret,
14
+ domain: 'localhost'
15
+ )
16
+
17
+ # Endpoint and security packet
18
+ itembank_uri = 'https://data.learnosity.com/latest-lts/itembank/items'
19
+ security_packet = {
20
+ 'consumer_key' => Rails.configuration.consumer_key,
21
+ 'domain' => 'localhost'
22
+ }
23
+
24
+ # Get SDK version
25
+ sdk_version = Learnosity::Sdk::VERSION
26
+
27
+ # Initialize request metadata
28
+ @request_metadata = {
29
+ endpoint: itembank_uri,
30
+ action: 'get',
31
+ status_code: nil,
32
+ headers: {
33
+ 'X-Learnosity-Consumer' => data_api.extract_consumer(security_packet),
34
+ 'X-Learnosity-Action' => data_api.derive_action(itembank_uri, 'get'),
35
+ 'X-Learnosity-SDK' => "Ruby:#{sdk_version}"
36
+ }
37
+ }
38
+
39
+ # Demo 1: Manual iteration (5 items)
40
+ @demo1_output = []
41
+ @demo1_error = nil
42
+
43
+ begin
44
+ data_request = { 'limit' => 1 }
45
+
46
+ 5.times do |i|
47
+ result = data_api.request(
48
+ itembank_uri,
49
+ security_packet,
50
+ Rails.configuration.consumer_secret,
51
+ data_request,
52
+ 'get'
53
+ )
54
+
55
+ # Capture status code from the first request
56
+ @request_metadata[:status_code] = result.code if i == 0
57
+
58
+ response = JSON.parse(result.body) rescue { 'raw_body' => result.body }
59
+
60
+ if response['data'] && response['data'].length > 0
61
+ item = response['data'][0]
62
+ @demo1_output << {
63
+ number: i + 1,
64
+ reference: item['reference'] || 'N/A',
65
+ status: item['status'] || 'N/A'
66
+ }
67
+ end
68
+
69
+ if response['meta'] && response['meta']['next']
70
+ data_request = { 'next' => response['meta']['next'] }
71
+ else
72
+ break
73
+ end
74
+ end
75
+ rescue => e
76
+ @demo1_error = {
77
+ error: "#{e.class}: #{e.message}",
78
+ backtrace: e.backtrace&.first(5)
79
+ }
80
+ end
81
+
82
+ # Demo 2: Page iteration (5 pages)
83
+ @demo2_output = []
84
+ @demo2_error = nil
85
+
86
+ begin
87
+ data_request = { 'limit' => 1 }
88
+ page_count = 0
89
+
90
+ data_api.request_iter(
91
+ itembank_uri,
92
+ security_packet,
93
+ Rails.configuration.consumer_secret,
94
+ data_request,
95
+ 'get'
96
+ ).each do |page|
97
+ page_count += 1
98
+ page_data = {
99
+ page_number: page_count,
100
+ item_count: page['data'] ? page['data'].length : 0,
101
+ items: []
102
+ }
103
+
104
+ if page['data']
105
+ page['data'].each do |item|
106
+ page_data[:items] << {
107
+ reference: item['reference'] || 'N/A',
108
+ status: item['status'] || 'N/A'
109
+ }
110
+ end
111
+ end
112
+
113
+ @demo2_output << page_data
114
+ break if page_count >= 5
115
+ end
116
+ rescue => e
117
+ @demo2_error = {
118
+ error: "#{e.class}: #{e.message}",
119
+ backtrace: e.backtrace&.first(5)
120
+ }
121
+ end
122
+
123
+ # Demo 3: Results iteration (5 items)
124
+ @demo3_output = []
125
+ @demo3_error = nil
126
+
127
+ begin
128
+ data_request = { 'limit' => 1 }
129
+ result_count = 0
130
+
131
+ data_api.results_iter(
132
+ itembank_uri,
133
+ security_packet,
134
+ Rails.configuration.consumer_secret,
135
+ data_request,
136
+ 'get'
137
+ ).each do |item|
138
+ result_count += 1
139
+ @demo3_output << {
140
+ number: result_count,
141
+ reference: item['reference'] || 'N/A',
142
+ status: item['status'] || 'N/A',
143
+ json: JSON.pretty_generate(item)[0..500]
144
+ }
145
+ break if result_count >= 5
146
+ end
147
+ rescue => e
148
+ @demo3_error = {
149
+ error: "#{e.class}: #{e.message}",
150
+ backtrace: e.backtrace&.first(5)
151
+ }
152
+ end
153
+ end
154
+ # rubocop:enable Metrics/CyclomaticComplexity
155
+ end
156
+
@@ -1,5 +1,5 @@
1
1
  require 'learnosity/sdk/request/init' # Learnosity helper.
2
- require 'securerandom' # Library for generating UUIDs.
2
+ require 'learnosity/sdk' # For UUID generation utility.
3
3
 
4
4
  class IndexController < ApplicationController
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'learnosity/sdk/request/init' # Learnosity helper.
2
- require 'securerandom' # Library for generating UUIDs.
2
+ require 'learnosity/sdk' # For UUID generation utility.
3
3
 
4
4
  class ItemsController < ApplicationController
5
5
  @@security_packet = {
@@ -12,9 +12,9 @@ class ItemsController < ApplicationController
12
12
  @@consumer_secret = Rails.configuration.consumer_secret
13
13
 
14
14
  @@items_request = {
15
- "user_id" => SecureRandom.uuid,
15
+ "user_id" => Learnosity::Sdk::Uuid.generate,
16
16
  "activity_template_id" => "quickstart_examples_activity_template_001",
17
- "session_id" => SecureRandom.uuid,
17
+ "session_id" => Learnosity::Sdk::Uuid.generate,
18
18
  "activity_id" => "quickstart_examples_activity_001",
19
19
  "rendering_type" => "assess",
20
20
  "type" => "submit_practice",
@@ -1,5 +1,5 @@
1
1
  require 'learnosity/sdk/request/init' # Learnosity helper.
2
- require 'securerandom'
2
+ require 'learnosity/sdk' # For UUID generation utility.
3
3
 
4
4
  class QuestionsController < ApplicationController
5
5
 
@@ -7,7 +7,7 @@ class QuestionsController < ApplicationController
7
7
  # XXX: This is a Learnosity Demos consumer; replace it with your own consumer key. Set values in application.rb.
8
8
  'consumer_key' => Rails.configuration.consumer_key,
9
9
  'domain' => 'localhost',
10
- 'user_id' => SecureRandom.uuid
10
+ 'user_id' => Learnosity::Sdk::Uuid.generate
11
11
  }
12
12
 
13
13
  # XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked into version control
@@ -1,5 +1,5 @@
1
1
  require 'learnosity/sdk/request/init' # Learnosity helper.
2
- require 'securerandom'
2
+ require 'learnosity/sdk' # For UUID generation utility.
3
3
 
4
4
  class ReportsController < ApplicationController
5
5
 
@@ -7,7 +7,7 @@ class ReportsController < ApplicationController
7
7
  # XXX: This is a Learnosity Demos consumer; replace it with your own consumer key. Set values in application.rb.
8
8
  'consumer_key' => Rails.configuration.consumer_key,
9
9
  'domain' => 'localhost',
10
- 'user_id' => SecureRandom.uuid
10
+ 'user_id' => Learnosity::Sdk::Uuid.generate
11
11
  }
12
12
 
13
13
  # XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked into version control
@@ -17,8 +17,8 @@ class ReportsController < ApplicationController
17
17
  "reports" => [{
18
18
  "id"=> "session-detail",
19
19
  "type"=> "session-detail-by-item",
20
- "user_id"=> "906d564c-39d4-44ba-8ddc-2d44066e2ba9",
21
- "session_id"=> "906d564c-39d4-44ba-8ddc-2d44066e2ba9"
20
+ "user_id"=> "student_0001",
21
+ "session_id"=> "ef4f80b8-e281-41f4-9efd-349b7eb9dd37"
22
22
  }]
23
23
  }
24
24
  def index
@@ -0,0 +1,6 @@
1
+ <h1>Standalone Authoraide Example</h1>
2
+ <div id="aiApp"></div>
3
+ <script src="https://authoraide.learnosity.com"></script>
4
+ <script>
5
+ var authoraideApp = LearnosityAuthorAide.init(<%= raw @init.generate %>, "#aiApp");
6
+ </script>