-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathitems_controller.rb
33 lines (29 loc) · 1.1 KB
/
items_controller.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
require 'learnosity/sdk/request/init' # Learnosity helper.
require 'securerandom' # Library for generating UUIDs.
class ItemsController < ApplicationController
@@security_packet = {
# XXX: This is a Learnosity Demos consumer; replace it with your own consumer key. Set values in application.rb.
'consumer_key' => Rails.configuration.consumer_key,
'domain' => 'localhost'
}
# XXX: The consumer secret should be in a properly secured credential store, and *NEVER* checked into version control
@@consumer_secret = Rails.configuration.consumer_secret
@@items_request = {
"user_id" => SecureRandom.uuid,
"activity_template_id" => "quickstart_examples_activity_template_001",
"session_id" => SecureRandom.uuid,
"activity_id" => "quickstart_examples_activity_001",
"rendering_type" => "assess",
"type" => "submit_practice",
"name" => "Items API Quickstart",
"state" => "initial"
}
def index
@init = Learnosity::Sdk::Request::Init.new(
'items',
@@security_packet,
@@consumer_secret,
@@items_request
)
end
end