-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from Learnosity/LRN-44058/feature/api-aide
[FEATURE] Add authoraide LRN-44064
- Loading branch information
Showing
8 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
docs/quickstart/assessment/src/main/java/com/learnosity/quickstart/AuthoraideApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.learnosity.quickstart; | ||
|
||
import learnositysdk.request.Init; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.json.JSONObject; | ||
|
||
public class AuthoraideApp extends App | ||
{ | ||
public String initOptions(String domain) { | ||
Map<String, String> security = createSecurityObject(domain); | ||
JSONObject request = createRequestObject(); | ||
String secret = config.getProperty("consumerSecret"); | ||
|
||
try { | ||
Init init = new Init("authoraide", security, secret, request); | ||
return init.generate(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return e.getMessage(); | ||
} | ||
} | ||
|
||
Map<String, String> createSecurityObject(String domain) { | ||
var security = new HashMap(); | ||
security.put("domain", domain); | ||
security.put("consumer_key", config.getProperty("consumer")); | ||
return security; | ||
} | ||
|
||
JSONObject createRequestObject() { | ||
JSONObject request = new JSONObject(); | ||
|
||
JSONObject user = new JSONObject(); | ||
user.put("id", "brianmoser"); | ||
user.put("firstname", "Test"); | ||
user.put("lastname", "Test"); | ||
user.put("email", "[email protected]"); | ||
request.put("user", user); | ||
|
||
return request; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/quickstart/assessment/src/main/webapp/AuthoraideApi.jsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<%@ page | ||
import="com.learnosity.quickstart.AuthoraideApp" | ||
language="java" contentType="text/html; charset=ISO-8859-1" | ||
pageEncoding="ISO-8859-1"%> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<%! | ||
private AuthoraideApp app; | ||
public void jspInit() { | ||
app = new AuthoraideApp(); | ||
} | ||
public void jspDestroy() { | ||
app = null; | ||
} | ||
%> | ||
<html> | ||
<head><link rel="stylesheet" type="text/css" href="css/style.css"></head> | ||
<body> | ||
<h1>Standalone Assessment Example - Authoraide API</h1> | ||
|
||
<!-- Authoraide API will be rendered the app into this div. --> | ||
<div id="aiApp"></div> | ||
|
||
<!-- Load the Authoraide API library. --> | ||
<script src="https://authoraide.learnosity.com"></script> | ||
|
||
<script> | ||
var authoraideApp = LearnosityAuthorAide.init( | ||
<%= app.initOptions(request.getServerName()) %>, | ||
"#aiApp" | ||
); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters