Skip to content

Commit

Permalink
Updated: Documentation
Browse files Browse the repository at this point in the history
Updated: Extension creation now supports multiple extensions
  • Loading branch information
rpc5102 committed Sep 24, 2020
1 parent a63f334 commit 8f69c1f
Show file tree
Hide file tree
Showing 55 changed files with 789 additions and 61 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: rlocker
Type: Package
Title: Learning Locker for Shiny
Version: 0.2.3
Date: 2019-12-10
Version: 0.2.4.4
Date: 2020-09-24
Authors@R: c(person("Robert", "Carey", email = "rpc5102@psu.edu",
role = c("aut", "cre")))
Maintainer: Robert Carey <rpc5102@psu.edu>
Expand All @@ -14,5 +14,5 @@ License: GPL-3.0+
Encoding: UTF-8
NeedsCompilation: no
LazyData: true
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
Depends: httr
16 changes: 16 additions & 0 deletions R/activity.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
#' @seealso \link{https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#activity-definition}
NULL

#' getActivityType
#'
#' Lookup Activity type in default list to see if it is valid.
#' Returns a `url` to definition if valid; if invalid returns `-1`.
#'
#' @param name Activity name
#' @param asJSON Return as json
#'
#' @return url
#'
#'@export
getActivityType <- function(name, asJSON = FALSE) {
exists <- exists(name, activityTypes)
Expand All @@ -21,6 +31,12 @@ getActivityType <- function(name, asJSON = FALSE) {
}
}

#' getActivityTypes
#'
#' Returns a list of the default Activity types.
#'
#' @return list
#'
#'@export
getActivityTypes <- function() {
return(names(activityTypes))
Expand Down
20 changes: 20 additions & 0 deletions R/actor.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
#' @seealso \link{https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#actor}
NULL

#' createActor
#'
#' @param agent Agent params
#' @param group Group params
#' @param warn Show warnings
#'
#' @return Actor
#'
#'@export
createActor <- function(
agent = NULL,
Expand All @@ -27,6 +35,12 @@ createActor <- function(
return(obj)
}

#' getActorDefinition
#'
#' Returns an empty Actor object with possible arguments.
#'
#' @return definition
#'
#'@export
getActorDefinition <- function() {
definition <- list(
Expand All @@ -45,6 +59,12 @@ getActorDefinition <- function() {
return(definition)
}

#' getActorTypes
#'
#' Returns a list of possible Actor types.
#'
#' @return list
#'
#'@export
getActorTypes <- function() {
return(actorTypes)
Expand Down
17 changes: 14 additions & 3 deletions R/agent.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@ agent <- function(...) {

#' Create an xAPI Agent
#'
#' @param agent Agent defaults
#' @param agent Agent params
#' @param warn Show warnings
#'
#' @seealso \code{agent}
#'
#' @return xAPI Agent object
#' @return Agent
#'
#' @examples
#' createAgent(agent = list(name = "John Doe", mbox = "mailto:john@example.com"))
#' createAgent(
#' agent = list(
#' name = "John Doe",
#' mbox = "mailto:john@example.com"
#' )
#' )
#'
#' @export
createAgent <- function(
Expand All @@ -62,6 +67,12 @@ createAgent <- function(
return(obj)
}

#' getAgentDefinition
#'
#' Returns an empty Agent object with possible arguments.
#'
#' @return definition
#'
#'@export
getAgentDefinition <- function() {
definition <- list(
Expand Down
12 changes: 12 additions & 0 deletions R/context.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#' @seealso \link{https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#context}
NULL

#' createContext
#'
#' @param context Context params
#'
#' @return Context
#'
#'@export
createContext <- function(
context = NULL,
Expand Down Expand Up @@ -74,6 +80,12 @@ createContext <- function(
return(obj)
}

#' getContextDefinition
#'
#' Returns an empty Context object with possible arguments.
#'
#' @return definition
#'
#'@export
getContextDefinition <- function() {
definition <- list(
Expand Down
15 changes: 13 additions & 2 deletions R/extensions.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ NULL
#'
#' @seealso \code{extension}
#'
#' @return xAPI Extension object
#' @return Extension
#'
#' @examples
#' createExtension(extension = list(ref = "https://w3id.org/xapi/cmi5/result/extensions/progress", value = 100))
#' createExtension(
#' extension = list(
#' ref = "https://w3id.org/xapi/cmi5/result/extensions/progress",
#' value = 100
#' )
#' )
#'
#' @export
createExtension <- function(
Expand All @@ -45,6 +50,12 @@ createExtension <- function(
return(obj)
}

#' getExtensionDefinition
#'
#' Returns an empty Extension object with possible arguments.
#'
#' @return definition
#'
#'@export
getExtensionDefinition <- function() {
definition <- list(
Expand Down
6 changes: 6 additions & 0 deletions R/group.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ createGroup <- function(
return(obj)
}

#' createGroupMembers
#'
#' @param members Group members
#'
#' @return list
#'
#' @export
createGroupMembers <- function(members){

Expand Down
16 changes: 16 additions & 0 deletions R/interface.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@
#'
#' @seealso \link{https://docs.learninglocker.net/http-rest/}

#' getInterfaceList
#'
#' Returns a vector of the Learning Locker API Interface types.
#'
#' @return vector
#'
#'@export
getInterfaceList <- function() {
return(names(interfaces))
}

#' getInterface
#'
#' Returns details about a specific Learning Locker API Interface.
#'
#' @param name Interface name
#' @param asJSON Return as json
#'
#' @name Interface
#'
#' @return Interface
#'
#' @export
getInterface <- function(name, asJSON = FALSE) {
exists <- exists(name, interfaces)
Expand Down
16 changes: 16 additions & 0 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,28 @@
#'
#' @seealso \link{https://docs.learninglocker.net/http-rest/}

#' getModelList
#'
#' Returns a vector of Learning Locker API Models.
#'
#' @return vector
#'
#' @export
getModelList <- function() {
return(names(models))
}

#' getModel
#'
#' Returns details of a specific Learning Locker API Model.
#'
#' @param name Model name
#' @param asJSON Return as json
#'
#' @return Model
#'
#' @name Model
#'
#' @export
getModel <- function(name, asJSON = FALSE) {
exists <- exists(name, models)
Expand Down
62 changes: 60 additions & 2 deletions R/object.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ NULL
#'
#' @seealso \code{object}
#'
#' @return xAPI Object object
#' @return Object
#'
#' @examples
#' createObject(object = list(name = "Question 1", description = "Example question description."))
#' createObject(
#' object = list(
#' name = "Question 1",
#' description = "Example question description."
#' )
#' )
#'
#' @export
createObject <- function(
Expand Down Expand Up @@ -96,6 +101,12 @@ createObject <- function(
return(obj)
}

#' getObjectDefinition
#'
#' Returns an empty Object with possible arguments.
#'
#' @return definition
#'
#'@export
getObjectDefinition <- function() {
definition <- list(
Expand All @@ -116,16 +127,34 @@ getObjectDefinition <- function() {
return(definition)
}

#' getObjectTypes
#'
#' Returns a list of the default Object types.
#'
#' @return vector
#'
#'@export
getObjectTypes <- function() {
return(objectTypes)
}

#' getInteractionTypes
#'
#' Returns a list of Interaction types.
#'
#' @return vector
#'
#'@export
getInteractionTypes <- function() {
return(names(interactionTypes))
}

#' getInteractionType
#'
#' Returns details about a specific Interaction type.
#'
#' @return Interaction
#'
#'@export
getInteractionType <- function(name, asJSON = FALSE) {
exists <- exists(name, interactionTypes)
Expand All @@ -139,6 +168,12 @@ getInteractionType <- function(name, asJSON = FALSE) {
}
}

#' getInteractionComponent
#'
#' Returns details about a specific Interaction Component.
#'
#' @return Component
#'
#'@export
getInteractionComponent <- function(name, asJSON = FALSE) {
exists <- exists(name, components)
Expand All @@ -157,11 +192,23 @@ getInteractionComponent <- function(name, asJSON = FALSE) {
}
}

#' getInteractionComponents
#'
#' Returns a list of the default Interaction Components.
#'
#' @return vector
#'
#'@export
getInteractionComponents <- function(){
return(names(components))
}

#' getSupportedComponents
#'
#' Returns a list of Components supported by a given Interaction type.
#'
#' @return
#'
#'@export
getSupportedComponents <- function(interactionType) {
exists <- match(interactionType, getInteractionTypes())
Expand All @@ -173,6 +220,11 @@ getSupportedComponents <- function(interactionType) {
}
}

#' checkSupportedComponents
#'
#' Check to see if provided Interaction Type supports the given Component.
#' Not all types will support all components as per the xAPI Specification.
#'
#'@export
checkSupportedComponents <- function(object) {
supported <- getSupportedComponents(object$interactionType)
Expand All @@ -198,6 +250,12 @@ checkSupportedComponents <- function(object) {
return(!flag)
}

#' validateObject
#'
#' Verifies the structure of an Object.
#'
#' @return boolean
#'
#'@export
validateObject <- function(object) {

Expand Down
Loading

0 comments on commit 8f69c1f

Please sign in to comment.