build/tincan.js
function (stmtId, cfg) {
            this.log("retrieveStatement");
            var requestCfg,
                requestResult,
                callbackWrapper,
                lrs = this;

            cfg = cfg || {};
            cfg.params = cfg.params || {};

            requestCfg = {
                url: "statements",
                method: "GET",
                params: {
                    statementId: stmtId
                }
            };
            if (cfg.params.attachments) {
                requestCfg.params.attachments = true;
                requestCfg.expectMultipart = true;
            }
            if (typeof cfg.callback !== "undefined") {
                callbackWrapper = function (err, xhr) {
                    var result = xhr;

                    if (err === null) {
                        result = lrs._processGetStatementResult(xhr, cfg.params);
                    }

                    cfg.callback(err, result);
                };
                requestCfg.callback = callbackWrapper;
            }

            requestResult = this.sendRequest(requestCfg);
            if (! callbackWrapper) {
                requestResult.statement = null;
                if (requestResult.err === null) {
                    requestResult.statement = lrs._processGetStatementResult(requestResult.xhr, cfg.params);
                }
            }

            return requestResult;
        }
function (stmtId, cfg) {
            this.log("retrieveStatement");
            var requestCfg,
                requestResult,
                callbackWrapper,
                lrs = this;

            cfg = cfg || {};
            cfg.params = cfg.params || {};

            requestCfg = {
                url: "statements",
                method: "GET",
                params: {
                    statementId: stmtId
                }
            };
            if (cfg.params.attachments) {
                requestCfg.params.attachments = true;
                requestCfg.expectMultipart = true;
            }
            if (typeof cfg.callback !== "undefined") {
                callbackWrapper = function (err, xhr) {
                    var result = xhr;

                    if (err === null) {
                        result = lrs._processGetStatementResult(xhr, cfg.params);
                    }

                    cfg.callback(err, result);
                };
                requestCfg.callback = callbackWrapper;
            }

            requestResult = this.sendRequest(requestCfg);
            if (! callbackWrapper) {
                requestResult.statement = null;
                if (requestResult.err === null) {
                    requestResult.statement = lrs._processGetStatementResult(requestResult.xhr, cfg.params);
                }
            }

            return requestResult;
        }
function ( stmtId , cfg ) { this . log ( "retrieveStatement" ) ; var requestCfg , requestResult , callbackWrapper , lrs = this ; cfg = cfg || { } ; cfg . params = cfg . params || { } ; requestCfg = { url : "statements" , method : "GET" , params : { statementId : stmtId } } ; if ( cfg . params . attachments ) { requestCfg . params . attachments = true ; requestCfg . expectMultipart = true ; } if ( typeof cfg . callback !== "undefined" ) { callbackWrapper = function ( err , xhr ) { var result = xhr ; if ( err === null ) { result = lrs . _processGetStatementResult ( xhr , cfg . params ) ; } cfg . callback ( err , result ) ; } ; requestCfg . callback = callbackWrapper ; } requestResult = this . sendRequest ( requestCfg ) ; if ( ! callbackWrapper ) { requestResult . statement = null ; if ( requestResult . err === null ) { requestResult . statement = lrs . _processGetStatementResult ( requestResult . xhr , cfg . params ) ; } } return requestResult ; }
Retrieve a statement, when used from a browser sends to the endpoint using the RESTful interface.

@method retrieveStatement
@param {String} ID of statement to retrieve
@param {Object} [cfg] Configuration options
@param {Object} [cfg.params] Query parameters
@param {Boolean} [cfg.params.attachments] Include attachments in multipart response or don't (default: false)
@param {Function} [cfg.callback] Callback to execute on completion
@return {TinCan.Statement} Statement retrieved
Retrieve a statement when used from a browser sends to the endpoint using the RESTful interface .