API Docs for: 0.50.0
Show:

TinCan.LRS Class

Defined in: src/LRS.js:25
Module: TinCan.LRS
Parent Module: TinCan

Constructor

TinCan.LRS

()

Defined in src/LRS.js:25

Methods

_assignAttachmentContent

(
  • [stmts]
  • [attachmentMap]
)
Array private

Defined in src/LRS.js:945

Assigns attachment content to the correct attachment to create a StatementsResult object that is sent to the callback of queryStatements()

Parameters:

  • [stmts] Array optional

    Array of TinCan.Statement JSON objects

  • [attachmentMap] Object optional

    Map of the content to place into its attachment

Returns:

Array:

Array of TinCan.Statement JSON objects with correctly assigned attachment content

_getBoundary

() private

Defined in src/LRS.js:160

Creates and returns a boundary for separating parts in requests where the statement has an attachment

_getMultipartRequestData

() private

Defined in src/LRS.js:194

Method should be overloaded by an environment to do per environment specifics for building multipart request data

_IEModeConversion

() private

Defined in src/LRS.js:205

Method is overloaded by the browser environment in order to test converting an HTTP request that is greater than a defined length

_initByEnvironment

() private

Defined in src/LRS.js:171

Method should be overloaded by an environment to do per environment specifics such that the LRS can make a call to set the version if not provided

_makeRequest

() private

Defined in src/LRS.js:183

Method should be overloaded by an environment to do per environment specifics for sending requests to the LRS

_parseHeaders

(
  • [rawHeaders]
)
Object private

Defined in src/LRS.js:1064

Parses the headers of a multipart/mixed response section

Parameters:

  • [rawHeaders] String optional

    String containing all the headers

Returns:

Object:

Map of the headers

_parseMultipart

(
  • [boundary]
  • [response]
)
Array private

Defined in src/LRS.js:970

Parses the different sections of a multipart/mixed response

Parameters:

  • [boundary] String optional

    Boundary used to mark off the sections of the response

  • [response] ArrayBuffer optional

    Body of the response

Returns:

Array:

Array of objects containing the parsed headers and body of each part

_queryStatementsRequestCfg

(
  • [cfg]
)
Object private

Defined in src/LRS.js:808

Build a request config object that can be passed to sendRequest() to make a query request

Parameters:

Returns:

Object:

Request configuration object

about

(
  • cfg
)
Object

Defined in src/LRS.js:301

Method used to determine the LRS version

Parameters:

  • cfg Object

    Configuration object for the about request

    • [callback] Function optional

      Callback to execute upon receiving a response

    • [params] Object optional

      this is needed, but can be empty

Returns:

Object:

About which holds the version, or asyncrhonously calls a specified callback

dropActivityProfile

(
  • key
  • cfg
)

Defined in src/LRS.js:1895

Drop an activity profile value, when used from a browser sends to the endpoint using the RESTful interface. Full activity profile delete is not supported by the spec.

Parameters:

  • key String | Null

    Key of activity profile to delete

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

dropAgentProfile

(
  • key
  • cfg
)

Defined in src/LRS.js:2223

Drop an agent profile value, when used from a browser sends to the endpoint using the RESTful interface. Full agent profile delete is not supported by the spec.

Parameters:

  • key String | Null

    Key of agent profile to delete

  • cfg Object

    Configuration options

    • agent TinCan.Agent

      Agent in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

dropState

(
  • key
  • cfg
)

Defined in src/LRS.js:1493

Drop a state value or all of the state, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String | Null

    Key of state to delete, or null for all

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • agent TinCan.Agent

      Agent in document identifier

    • [registration] String optional

      Registration

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

init

()

Defined in src/LRS.js:76

log

()

Defined in src/LRS.js:71

moreStatements

(
  • [cfg]
)
Object

Defined in src/LRS.js:1098

Fetch more statements from a previous query, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.

Parameters:

  • [cfg] Object optional

    Configuration used to query

    • [url] String optional

      More URL

    • [callback] Function optional

      Callback to execute on completion

      • err String | Null
        Error status or null if succcess
      • response TinCan.StatementsResult | XHR
        Receives a StatementsResult argument

Returns:

Object:

Request result

queryStatements

(
  • [cfg]
)
Object

Defined in src/LRS.js:692

Fetch a set of statements, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.

Parameters:

  • [cfg] Object optional

    Configuration used to query

    • [params] Object optional

      Query parameters

      • [agent] TinCan.Agent | TinCan.Group optional
        Agent matches 'actor' or 'object'
      • [verb] TinCan.Verb | String optional
        Verb (or verb ID) to query on
      • [activity] TinCan.Activity | String optional
        Activity (or activity ID) to query on
      • [registration] String optional
        Registration UUID
      • [related_activities] Boolean optional
        Match related activities
      • [related_agents] Boolean optional
        Match related agents
      • [since] String optional
        Match statements stored since specified timestamp
      • [until] String optional
        Match statements stored at or before specified timestamp
      • [limit] Integer optional
        Number of results to retrieve
      • [format] String optional
        One of "ids", "exact", "canonical" (default: "exact")
      • [ascending] Boolean optional
        Return results in ascending order of stored time
      • [actor] TinCan.Agent optional
        (Removed in 1.0.0, use 'agent' instead) Agent matches 'actor'
      • [target] TinCan.Activity | TinCan.Agent | TinCan.Statement optional
        (Removed in 1.0.0, use 'activity' or 'agent' instead) Activity, Agent, or Statement matches 'object'
      • [instructor] TinCan.Agent optional
        (Removed in 1.0.0, use 'agent' + 'related_agents' instead) Agent matches 'context:instructor'
      • [context] Boolean optional
        (Removed in 1.0.0, use 'activity' instead) When filtering on target, include statements with matching context
      • [authoritative] Boolean optional
        (Removed in 1.0.0) Get authoritative results
      • [sparse] Boolean optional
        (Removed in 1.0.0, use 'format' instead) Get sparse results
    • [callback] Function optional

      Callback to execute on completion

      • err String | Null
        Error status or null if succcess
      • response TinCan.StatementsResult | XHR
        Receives a StatementsResult argument

Returns:

Object:

Request result

retrieveActivity

(
  • activityId
  • cfg
)
Object

Defined in src/LRS.js:1548

Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • activityId String

    id of the Activity to retrieve

  • cfg Object

    Configuration options

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Object:

Value retrieved

retrieveActivityProfile

(
  • key
  • cfg
)
Object

Defined in src/LRS.js:1625

Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of activity profile to retrieve

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Object:

Value retrieved

retrieveActivityProfileIds

(
  • cfg
)
Array

Defined in src/LRS.js:1756

Retrieve the list of IDs for an activity profile, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [since] String optional

      Match activity profiles saved since given timestamp

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Array:

List of ids for this Activity profile

retrieveAgentProfile

(
  • key
  • cfg
)
Object

Defined in src/LRS.js:1933

Retrieve an agent profile value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of agent profile to retrieve

  • cfg Object

    Configuration options

    • agent TinCan.Agent

      Agent in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Object:

Value retrieved

retrieveAgentProfileIds

(
  • cfg
)
Array

Defined in src/LRS.js:2070

Retrieve the list of profileIds for an agent profile, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • cfg Object

    Configuration options

    • agent TinCan.Agent

      Agent in document identifier

    • [callback] Function optional

      Callback to execute on completion

    • [since] String optional

      Match activity profiles saved since given timestamp

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Array:

List of profileIds for this Agent

retrieveState

(
  • key
  • cfg
)
TinCan.State | Object

Defined in src/LRS.js:1169

Retrieve a state value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of state to retrieve

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • agent TinCan.Agent

      Agent in document identifier

    • [registration] String optional

      Registration

    • [callback] Function optional

      Callback to execute on completion

      • error Object | Null
      • result TinCan.State | Null
        null if state is 404
    • [requestHeaders] Object optional

      Object containing additional headers to add to request

Returns:

TinCan.State | Object:

TinCan.State retrieved when synchronous, or result from sendRequest

retrieveStateIds

(
  • cfg
)
Object

Defined in src/LRS.js:1321

Retrieve the list of IDs for a state, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • agent TinCan.Agent

      Agent in document identifier

    • [registration] String optional

      Registration

    • [callback] Function optional

      Callback to execute on completion

    • [since] String optional

      Match activity profiles saved since given timestamp

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

Returns:

Object:

requestResult Request result

retrieveStatement

(
  • ID
  • [cfg]
)
TinCan.Statement

Defined in src/LRS.js:456

Retrieve a statement, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • ID String

    of statement to retrieve

  • [cfg] Object optional

    Configuration options

    • [params] Object optional

      Query parameters

      • [attachments] Boolean optional
        Include attachments in multipart response or don't (default: false)
    • [callback] Function optional

      Callback to execute on completion

Returns:

TinCan.Statement:

Statement retrieved

retrieveVoidedStatement

(
  • ID
  • [cfg]
)
TinCan.Statement

Defined in src/LRS.js:512

Retrieve a voided statement, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • ID String

    of voided statement to retrieve

  • [cfg] Object optional

    Configuration options

    • [params] Object optional

      Query parameters

      • [attachments] Boolean optional
        Include attachments in multipart response or don't (default: false)
    • [callback] Function optional

      Callback to execute on completion

Returns:

TinCan.Statement:

Statement retrieved

saveActivityProfile

(
  • key
  • val
  • cfg
)

Defined in src/LRS.js:1837

Save an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of activity profile to retrieve

  • val Object

    Value to be stored

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • [lastSHA1] String optional

      SHA1 of the previously seen existing profile

    • [contentType] String optional

      Content-Type to specify in headers (defaults to 'application/octet-stream')

    • [method] String optional

      Method to use. Default: PUT

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

saveAgentProfile

(
  • key
  • val
  • cfg
)

Defined in src/LRS.js:2159

Save an agent profile value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of agent profile to retrieve

  • val Object

    Value to be stored

  • cfg Object

    Configuration options

    • agent TinCan.Agent

      Agent in document identifier

    • [lastSHA1] String optional

      SHA1 of the previously seen existing profile

    • [contentType] String optional

      Content-Type to specify in headers (defaults to 'application/octet-stream')

    • [method] String optional

      Method to use. Default: PUT

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

saveState

(
  • key
  • val
  • cfg
)

Defined in src/LRS.js:1419

Save a state value, when used from a browser sends to the endpoint using the RESTful interface.

Parameters:

  • key String

    Key of state to save

  • val Object

    Value to be stored

  • cfg Object

    Configuration options

    • activity TinCan.Activity

      Activity in document identifier

    • agent TinCan.Agent

      Agent in document identifier

    • [registration] String optional

      Registration

    • [lastSHA1] String optional

      SHA1 of the previously seen existing state

    • [contentType] String optional

      Content-Type to specify in headers (defaults to 'application/octet-stream')

    • [method] String optional

      Method to use. Default: PUT

    • [callback] Function optional

      Callback to execute on completion

    • [requestHeaders] Object optional

      Optional object containing additional headers to add to request

saveStatement

(
  • statement
  • [cfg]
)

Defined in src/LRS.js:348

Save a statement, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.

Parameters:

  • statement TinCan.Statement

    to send

  • [cfg] Object optional

    Configuration used when saving

    • [callback] Function optional

      Callback to execute on completion

saveStatements

(
  • Array
  • [cfg]
)

Defined in src/LRS.js:573

Save a set of statements, when used from a browser sends to the endpoint using the RESTful interface. Use a callback to make the call asynchronous.

Parameters:

  • Array Array

    of statements or objects convertable to statements

  • [cfg] Object optional

    Configuration used when saving

    • [callback] Function optional

      Callback to execute on completion

sendRequest

(
  • cfg
)
Object

Defined in src/LRS.js:240

Method used to send a request via browser objects to the LRS

Parameters:

  • cfg Object

    Configuration for request

    • url String

      URL portion to add to endpoint

    • [method] String optional

      GET, PUT, POST, etc.

    • [params] Object optional

      Parameters to set on the querystring

    • [data] String | ArrayBuffer optional

      Body content as a String or ArrayBuffer

    • [headers] Object optional

      Additional headers to set in the request

    • [callback] Function optional

      Function to run at completion

      • err String | Null
        If an error occurred, this parameter will contain the HTTP status code. If the operation succeeded, err will be null.
      • xhr Object
        XHR object
    • [ignore404] Boolean optional

      Whether 404 status codes should be considered an error

    • [expectMultipart] Boolean optional

      Whether to expect the response to be a multipart response

Returns:

Object:

XHR if called in a synchronous way (in other words no callback)

Properties

allowFail

Boolean

Defined in src/LRS.js:50

Default: true

auth

String

Defined in src/LRS.js:44

endpoint

String

Defined in src/LRS.js:32

extended

Object

Defined in src/LRS.js:57

LOG_SRC

Unknown

Defined in src/LRS.js:66

version

String

Defined in src/LRS.js:38