Skip to content

Commit

Permalink
Build 0.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjmiller committed Nov 25, 2015
1 parent 2065520 commit 9a3d88c
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tincan",
"version": "0.40.0",
"version": "0.41.0",
"homepage": "http://rusticisoftware.github.com/TinCanJS/",
"authors": [
"Brian J. Miller <brian.miller@rusticisoftware.com>"
Expand Down
6 changes: 3 additions & 3 deletions build/tincan-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/tincan-min.map

Large diffs are not rendered by default.

79 changes: 78 additions & 1 deletion build/tincan-node.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"0.40.0";
"0.41.0";
/*
CryptoJS v3.0.2
code.google.com/p/crypto-js
Expand Down Expand Up @@ -2984,6 +2984,83 @@ TinCan client library
return this.sendRequest(requestCfg);
},

/**
Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.
@method retrieveActivity
@param {String} activityId id of the Activity to retrieve
@param {Object} cfg Configuration options
@param {Function} [cfg.callback] Callback to execute on completion
@param {Object} [cfg.requestHeaders] Optional object containing additional headers to add to request
@return {Object} Value retrieved
*/
retrieveActivity: function (activityId, cfg) {
this.log("retrieveActivity");
var requestCfg = {},
requestResult,
callbackWrapper,
requestHeaders;

requestHeaders = cfg.requestHeaders || {};

requestCfg = {
url: "activities",
method: "GET",
params: {
activityId: activityId
},
ignore404: true,
headers: requestHeaders
};

if (typeof cfg.callback !== "undefined") {
callbackWrapper = function (err, xhr) {
var result = xhr;

if (err === null) {
//
// a 404 really shouldn't happen because the LRS can dynamically
// build the response based on what has been passed to it, but
// don't have the client fail in the condition that it does, because
// we can do the same thing
//
if (xhr.status === 404) {
result = new TinCan.Activity(
{
id: activityId
}
);
}
else {
result = TinCan.Activity.fromJSON(xhr.responseText);
}
}

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

requestResult = this.sendRequest(requestCfg);
if (! callbackWrapper) {
requestResult.activity = null;
if (requestResult.err === null) {
if (requestResult.xhr.status === 404) {
requestResult.activity = new TinCan.Activity(
{
id: activityId
}
);
}
else {
requestResult.activity = TinCan.Activity.fromJSON(requestResult.xhr.responseText);
}
}
}

return requestResult;
},

/**
Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
Expand Down
79 changes: 78 additions & 1 deletion build/tincan.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"0.40.0";
"0.41.0";
/*
CryptoJS v3.0.2
code.google.com/p/crypto-js
Expand Down Expand Up @@ -2984,6 +2984,83 @@ TinCan client library
return this.sendRequest(requestCfg);
},

/**
Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.
@method retrieveActivity
@param {String} activityId id of the Activity to retrieve
@param {Object} cfg Configuration options
@param {Function} [cfg.callback] Callback to execute on completion
@param {Object} [cfg.requestHeaders] Optional object containing additional headers to add to request
@return {Object} Value retrieved
*/
retrieveActivity: function (activityId, cfg) {
this.log("retrieveActivity");
var requestCfg = {},
requestResult,
callbackWrapper,
requestHeaders;

requestHeaders = cfg.requestHeaders || {};

requestCfg = {
url: "activities",
method: "GET",
params: {
activityId: activityId
},
ignore404: true,
headers: requestHeaders
};

if (typeof cfg.callback !== "undefined") {
callbackWrapper = function (err, xhr) {
var result = xhr;

if (err === null) {
//
// a 404 really shouldn't happen because the LRS can dynamically
// build the response based on what has been passed to it, but
// don't have the client fail in the condition that it does, because
// we can do the same thing
//
if (xhr.status === 404) {
result = new TinCan.Activity(
{
id: activityId
}
);
}
else {
result = TinCan.Activity.fromJSON(xhr.responseText);
}
}

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

requestResult = this.sendRequest(requestCfg);
if (! callbackWrapper) {
requestResult.activity = null;
if (requestResult.err === null) {
if (requestResult.xhr.status === 404) {
requestResult.activity = new TinCan.Activity(
{
id: activityId
}
);
}
else {
requestResult.activity = TinCan.Activity.fromJSON(requestResult.xhr.responseText);
}
}
}

return requestResult;
},

/**
Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tincanjs",
"description": "Tin Can API Library",
"version": "0.40.0",
"version": "0.41.0",
"private": false,
"main": "build/tincan-node.js",
"directories": {
Expand Down

0 comments on commit 9a3d88c

Please sign in to comment.