build/tincan.js
function (key, val, cfg) {
            this.log("saveActivityProfile");
            var requestCfg,
                requestHeaders;

            requestHeaders = cfg.requestHeaders || {};

            if (typeof cfg.contentType === "undefined") {
                cfg.contentType = "application/octet-stream";
            }
            requestHeaders["Content-Type"] = cfg.contentType;

            if (typeof cfg.method === "undefined" || cfg.method !== "POST") {
                cfg.method = "PUT";
            }

            if (typeof val === "object" && TinCan.Utils.isApplicationJSON(cfg.contentType)) {
                val = JSON.stringify(val);
            }

            requestCfg = {
                url: "activities/profile",
                method: cfg.method,
                params: {
                    profileId: key,
                    activityId: cfg.activity.id
                },
                data: val,
                headers: requestHeaders
            };

            if (typeof cfg.callback !== "undefined") {
                requestCfg.callback = cfg.callback;
            }
            if (typeof cfg.lastSHA1 !== "undefined" && cfg.lastSHA1 !== null) {
                requestCfg.headers["If-Match"] = cfg.lastSHA1;
            }
            else {
                requestCfg.headers["If-None-Match"] = "*";
            }

            return this.sendRequest(requestCfg);
        }
function (key, val, cfg) {
            this.log("saveActivityProfile");
            var requestCfg,
                requestHeaders;

            requestHeaders = cfg.requestHeaders || {};

            if (typeof cfg.contentType === "undefined") {
                cfg.contentType = "application/octet-stream";
            }
            requestHeaders["Content-Type"] = cfg.contentType;

            if (typeof cfg.method === "undefined" || cfg.method !== "POST") {
                cfg.method = "PUT";
            }

            if (typeof val === "object" && TinCan.Utils.isApplicationJSON(cfg.contentType)) {
                val = JSON.stringify(val);
            }

            requestCfg = {
                url: "activities/profile",
                method: cfg.method,
                params: {
                    profileId: key,
                    activityId: cfg.activity.id
                },
                data: val,
                headers: requestHeaders
            };

            if (typeof cfg.callback !== "undefined") {
                requestCfg.callback = cfg.callback;
            }
            if (typeof cfg.lastSHA1 !== "undefined" && cfg.lastSHA1 !== null) {
                requestCfg.headers["If-Match"] = cfg.lastSHA1;
            }
            else {
                requestCfg.headers["If-None-Match"] = "*";
            }

            return this.sendRequest(requestCfg);
        }
function ( key , val , cfg ) { this . log ( "saveActivityProfile" ) ; var requestCfg , requestHeaders ; requestHeaders = cfg . requestHeaders || { } ; if ( typeof cfg . contentType === "undefined" ) { cfg . contentType = "application/octet-stream" ; } requestHeaders [ "Content-Type" ] = cfg . contentType ; if ( typeof cfg . method === "undefined" || cfg . method !== "POST" ) { cfg . method = "PUT" ; } if ( typeof val === "object" && TinCan . Utils . isApplicationJSON ( cfg . contentType ) ) { val = JSON . stringify ( val ) ; } requestCfg = { url : "activities/profile" , method : cfg . method , params : { profileId : key , activityId : cfg . activity . id } , data : val , headers : requestHeaders } ; if ( typeof cfg . callback !== "undefined" ) { requestCfg . callback = cfg . callback ; } if ( typeof cfg . lastSHA1 !== "undefined" && cfg . lastSHA1 !== null ) { requestCfg . headers [ "If-Match" ] = cfg . lastSHA1 ; } else { requestCfg . headers [ "If-None-Match" ] = "*" ; } return this . sendRequest ( requestCfg ) ; }
Save an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.

@method saveActivityProfile
@param {String} key Key of activity profile to retrieve
@param val Value to be stored
@param {Object} cfg Configuration options
@param {TinCan.Activity} cfg.activity Activity in document identifier
@param {String} [cfg.lastSHA1] SHA1 of the previously seen existing profile
@param {String} [cfg.contentType] Content-Type to specify in headers (defaults to 'application/octet-stream')
@param {String} [cfg.method] Method to use. Default: PUT
@param {Function} [cfg.callback] Callback to execute on completion
@param {Object} [cfg.requestHeaders] Optional object containing additional headers to add to request
Save an activity profile value when used from a browser sends to the endpoint using the RESTful interface .