TinCan Class
Constructor
TinCan
    
        - 
                    
                        
[options] 
Parameters:
- 
                    
                        
[options]Object optionalConfiguration used to initialize.
- 
                                
                                    
[url]String optionalURL for determining launch provided configuration options
 - 
                                
                                    
[recordStores]Array optionallist of pre-configured LRSes
 - 
                                
                                    
[actor]Object | TinCan.Agent optionaldefault actor
 - 
                                
                                    
[activity]Object | TinCan.Activity optionaldefault activity
 - 
                                
                                    
[registration]String optionaldefault registration
 - 
                                
                                    
[context]Object | TinCan.Context optionaldefault context
 
 - 
                                
                                    
 
Item Index
Methods
- _initFromQueryString
 - addRecordStore
 - deleteActivityProfile
 - deleteAgentProfile
 - deleteState
 - disableDebug static
 - enableDebug static
 - getActivityProfile
 - getAgentProfile
 - getState
 - getStatement
 - getStatements
 - getVoidedStatement
 - init
 - log
 - prepareStatement
 - sendStatement
 - sendStatements
 - setActivityProfile
 - setAgentProfile
 - setState
 - versions static
 - voidStatement
 
Properties
Methods
_initFromQueryString
    
        - 
                    
                        
url 
Parameters:
- 
                    
                        
urlString 
addRecordStore
    
        - 
                    
                        
Configuration 
Parameters:
- 
                    
                        
ConfigurationObjectdata
- TODO:
 - check endpoint for trailing '/'
 - check for unique endpoints
 
 
deleteActivityProfile
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyString | NullKey to remove from the activity profile, or null to clear all
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with activity profile
 
 - 
                                
                                    
 
deleteAgentProfile
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyString | NullKey to remove from the agent profile, or null to clear all
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with agent profile
 
 - 
                                
                                    
 
deleteState
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyString | NullKey to remove from the state, or null to clear all
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[registration]Object optionalRegistration used in query, defaults to 'registration' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with state
 
 - 
                                
                                    
 
disableDebug
    
        ()
    
    
    
    
    
    
        static
    
    
    
    
    Turn off debug logging
enableDebug
    
        ()
    
    
    
    
    
    
        static
    
    
    
    
    Turn on debug logging
getActivityProfile
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to retrieve from the profile
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with activity profile
 
 - 
                                
                                    
 
getAgentProfile
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to retrieve from the profile
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with agent profile
 
 - 
                                
                                    
 
getState
    
        - 
                    
                        
key - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to retrieve from the state
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[registration]Object optionalRegistration used in query, defaults to 'registration' property if empty
 - 
                                
                                    
[callback]Function optionalFunction to run with state
 
 - 
                                
                                    
 
getStatement
    
        - 
                    
                        
[stmtId] - 
                    
                        
[callback] - 
                    
                        
[cfg] - 
                    
                        
[params] - 
                    
                        
[attachments] 
Calls retrieveStatement on the first LRS, provide callback to make it asynchronous
Parameters:
- 
                    
                        
[stmtId]String optionalStatement ID to get
 - 
                    
                        
[callback]Function optionalCallback function to execute on completion
 - 
                    
                        
[cfg]Object optionalConfiguration data
 - 
                    
                        
[params]Object optionalQuery parameters
 - 
                    
                        
[attachments]Boolean optionalInclude attachments in multipart response or don't (defualt: false)
 
Returns:
Array of results, or single result
TODO: make TinCan track statements it has seen in a local cache to be returned easily
getStatements
    
        - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[sendActor]Boolean optionalInclude default actor in query params
 - 
                                
                                    
[sendActivity]Boolean optionalInclude default activity in query params
 - 
                                
                                    
[params]Object optionalParameters used to filter. These are the same as those accepted by the LRS.queryStatements method.
 - 
                                
                                    
[callback]Function optionalFunction to run at completion
TODO: support multiple LRSs and flag to use single
 
 - 
                                
                                    
 
getVoidedStatement
    
        - 
                    
                        
statement - 
                    
                        
[callback] 
Calls retrieveVoidedStatement on the first LRS, provide callback to make it asynchronous
Parameters:
- 
                    
                        
statementStringStatement ID to get
 - 
                    
                        
[callback]Function optionalCallback function to execute on completion
 
Returns:
Array of results, or single result
TODO: make TinCan track voided statements it has seen in a local cache to be returned easily
init
    
        - 
                    
                        
[options] 
Parameters:
- 
                    
                        
[options]Object optionalConfiguration used to initialize (see TinCan constructor).
 
log
    
        - 
                    
                        
msg 
Safe version of logging, only displays when .DEBUG is true, and console.log is available
Parameters:
- 
                    
                        
msgStringMessage to output
 
prepareStatement
    
        - 
                    
                        
Base 
Parameters:
- 
                    
                        
BaseObject | TinCan.Statementstatement properties or pre-created TinCan.Statement instance
 
Returns:
sendStatement
    
        - 
                    
                        
statement - 
                    
                        
[callback] 
Calls saveStatement on each configured LRS, provide callback to make it asynchronous
Parameters:
- 
                    
                        
statementTinCan.Statement | ObjectSend statement to LRS
 - 
                    
                        
[callback]Function optionalCallback function to execute on completion
 
sendStatements
    
        - 
                    
                        
Array - 
                    
                        
Callback 
Calls saveStatements with list of prepared statements
Parameters:
- 
                    
                        
ArrayArrayof statements to send
 - 
                    
                        
CallbackFunctionfunction to execute on completion
 
setActivityProfile
    
        - 
                    
                        
key - 
                    
                        
val - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to store into the activity profile
 - 
                    
                        
valString | ObjectValue to store into the activity profile, objects will be stringified to JSON
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[lastSHA1]String optionalSHA1 of the previously seen existing profile
 - 
                                
                                    
[contentType]String optionalContent-Type to specify in headers
 - 
                                
                                    
[overwriteJSON]Boolean optionalIf the Content-Type is JSON, should a PUT be used?
 - 
                                
                                    
[callback]Function optionalFunction to run with activity profile
 
 - 
                                
                                    
 
setAgentProfile
    
        - 
                    
                        
key - 
                    
                        
val - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to store into the agent profile
 - 
                    
                        
valString | ObjectValue to store into the agent profile, objects will be stringified to JSON
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[lastSHA1]String optionalSHA1 of the previously seen existing profile
 - 
                                
                                    
[contentType]String optionalContent-Type to specify in headers
 - 
                                
                                    
[overwriteJSON]Boolean optionalIf the Content-Type is JSON, should a PUT be used?
 - 
                                
                                    
[callback]Function optionalFunction to run with agent profile
 
 - 
                                
                                    
 
setState
    
        - 
                    
                        
key - 
                    
                        
val - 
                    
                        
[cfg] 
Parameters:
- 
                    
                        
keyStringKey to store into the state
 - 
                    
                        
valString | ObjectValue to store into the state, objects will be stringified to JSON
 - 
                    
                        
[cfg]Object optionalConfiguration for request
- 
                                
                                    
[agent]Object optionalAgent used in query, defaults to 'actor' property if empty
 - 
                                
                                    
[activity]Object optionalActivity used in query, defaults to 'activity' property if empty
 - 
                                
                                    
[registration]Object optionalRegistration used in query, defaults to 'registration' property if empty
 - 
                                
                                    
[lastSHA1]String optionalSHA1 of the previously seen existing state
 - 
                                
                                    
[contentType]String optionalContent-Type to specify in headers
 - 
                                
                                    
[overwriteJSON]Boolean optionalIf the Content-Type is JSON, should a PUT be used?
 - 
                                
                                    
[callback]Function optionalFunction to run with state
 
 - 
                                
                                    
 
versions
    
        ()
    
    
        
            Array
        
    
    
    
    
    
        static
    
    
    
    
    Returns:
Array of supported version numbers
voidStatement
    
        - 
                    
                        
statement - 
                    
                        
[callback] - 
                    
                        
[options] 
Creates a statement used for voiding the passed statement/statement ID and calls send statement with the voiding statement.
Parameters:
- 
                    
                        
statementTinCan.Statement | StringStatement or statement ID to void
 - 
                    
                        
[callback]Function optionalCallback function to execute on completion
 - 
                    
                        
[options]Object optionalOptions used to build voiding statement
- 
                                
                                    
[actor]TinCan.Agent optionalAgent to be used as 'actor' in voiding statement
 
 - 
                                
                                    
 
Properties
activity
    Object
    
    
    
    
    
    Default activity, may be used as a statement 'target' or incorporated into 'context'
actor
    Object
    
    
    
    
    
    Default actor used when preparing statements that don't yet have an actor set, and for saving state, etc.
context
    Object
    
    
    
    
    
    Default context used when preparing statements that don't yet have a context set, or mixed in when one has been provided, properties do NOT override on mixing
DEBUG
    Unknown
    
    
    
    
        static
    
    
    Default: false
recordStores
    Array
    
    
    
    
    
    registration
    String
    
    
    
    
    
    Default registration, included in default context when provided, otherwise used in statement queries
