build/tincan.js
function (key, val, cfg) {
            this.log("saveAgentProfile");
            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 = {
                method: cfg.method,
                params: {
                    profileId: key
                },
                data: val,
                headers: requestHeaders
            };

            if (this.version === "0.9") {
                requestCfg.url = "actors/profile";
                requestCfg.params.actor = JSON.stringify(cfg.agent.asVersion(this.version));
            }
            else {
                requestCfg.url = "agents/profile";
                requestCfg.params.agent = JSON.stringify(cfg.agent.asVersion(this.version));
            }
            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("saveAgentProfile");
            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 = {
                method: cfg.method,
                params: {
                    profileId: key
                },
                data: val,
                headers: requestHeaders
            };

            if (this.version === "0.9") {
                requestCfg.url = "actors/profile";
                requestCfg.params.actor = JSON.stringify(cfg.agent.asVersion(this.version));
            }
            else {
                requestCfg.url = "agents/profile";
                requestCfg.params.agent = JSON.stringify(cfg.agent.asVersion(this.version));
            }
            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 ( "saveAgentProfile" ) ; 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 = { method : cfg . method , params : { profileId : key } , data : val , headers : requestHeaders } ; if ( this . version === "0.9" ) { requestCfg . url = "actors/profile" ; requestCfg . params . actor = JSON . stringify ( cfg . agent . asVersion ( this . version ) ) ; } else { requestCfg . url = "agents/profile" ; requestCfg . params . agent = JSON . stringify ( cfg . agent . asVersion ( this . version ) ) ; } 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 agent profile value, when used from a browser sends to the endpoint using the RESTful interface.

@method saveAgentProfile
@param {String} key Key of agent profile to retrieve
@param val Value to be stored
@param {Object} cfg Configuration options
@param {TinCan.Agent} cfg.agent Agent 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 agent profile value when used from a browser sends to the endpoint using the RESTful interface .