Skip to content

Commit

Permalink
Merge pull request #80 from Learnosity/LRN-44282/polish/add-version-t…
Browse files Browse the repository at this point in the history
…o-tag

[Polish] Added test page for author aide and fixed version LRN-4482
  • Loading branch information
bhavya-shukla-lrn authored and sreenivasa-murty-lrn committed Jul 10, 2024
1 parent d26e587 commit 2c4a567
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.2
v1.0.3
71 changes: 71 additions & 0 deletions docs/quickstart/ai/author-aide.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

/**
* Copyright (c) 2021 Learnosity, MIT License
*
* Basic example of embedding Author aide API
*/

// - - - - - - Section 1: server-side configuration - - - - - - //

// Include server side Learnosity SDK, and set up variables related to user access
require_once __DIR__ . '/../../../bootstrap.php';
$config = require_once __DIR__ . '/../config.php'; // Load security keys from config.php.
use LearnositySdk\Request\Init;

// Author aide API configuration parameters.
$request = [
'user' => [
'id' => 'brian',
'firstname' => 'Brian',
'lastname' => 'Smith',
'email' => '[email protected]'
]
];

// Public & private security keys required to access Learnosity APIs and
// data. These keys grant access to Learnosity's public demos account,
// loaded from a configuration file on line 13.
// Learnosity will provide keys for your own private account.
$consumerKey = $config['consumerKey'];
$consumerSecret = $config['consumerSecret'];

// Parameters used to create security authorization.
$security = [
'domain' => $_SERVER['SERVER_NAME'],
'consumer_key' => $consumerKey
];

// Use Learnosity SDK to construct Author aide API configuration parameters,
// and sign them securely with the $security and $consumerSecret parameters.
$init = new Init(
'authoraide',
$security,
$consumerSecret,
$request
);
$initOptions = $init->generate();
?>

<!-- Section 2: Web page content. -->
<!DOCTYPE html>
<html>
<head><link rel="stylesheet" type="text/css" href="../css/style.css"></head>
<body>
<h1> AuthorAide Example</h1>

<!-- Author aide API will render the author app into this div. -->
<div id="aiApp"></div>

<!-- Include the Author aide API library. -->
<script src="https://authoraide.learnosity.com"></script>

<!-- Initiate Author aide API rendering, using the JSON blob of signed params. -->
<script>
var authoraideApp = LearnosityAuthorAide.init(
<?php echo $initOptions ?>,
'#aiApp'
);
</script>
</body>
</html>
4 changes: 4 additions & 0 deletions docs/quickstart/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<h1>Learnosity Quick Start Examples</h1>
<h3><i class="li-authorapi hero-icon"></i> Authoring examples</h3>
<ul class="api-list">
<li>
<a href="ai/author-aide.php">Author aide</a>
<p>Create and translate questions using AI</p>
</li>
<li>
<a href="authoring/authoring-items.php">Authoring Items</a>
<p>Create and edit <em>Items</em> for your <em>Item bank</em>.</p>
Expand Down

0 comments on commit 2c4a567

Please sign in to comment.