Skip to content

Commit 9a3d88c

Browse files
committed
Build 0.41.0
1 parent 2065520 commit 9a3d88c

File tree

6 files changed

+162
-8
lines changed

6 files changed

+162
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tincan",
3-
"version": "0.40.0",
3+
"version": "0.41.0",
44
"homepage": "http://rusticisoftware.github.com/TinCanJS/",
55
"authors": [
66
"Brian J. Miller <brian.miller@rusticisoftware.com>"

build/tincan-min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/tincan-min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/tincan-node.js

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"0.40.0";
1+
"0.41.0";
22
/*
33
CryptoJS v3.0.2
44
code.google.com/p/crypto-js
@@ -2984,6 +2984,83 @@ TinCan client library
29842984
return this.sendRequest(requestCfg);
29852985
},
29862986

2987+
/**
2988+
Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.
2989+
2990+
@method retrieveActivity
2991+
@param {String} activityId id of the Activity to retrieve
2992+
@param {Object} cfg Configuration options
2993+
@param {Function} [cfg.callback] Callback to execute on completion
2994+
@param {Object} [cfg.requestHeaders] Optional object containing additional headers to add to request
2995+
@return {Object} Value retrieved
2996+
*/
2997+
retrieveActivity: function (activityId, cfg) {
2998+
this.log("retrieveActivity");
2999+
var requestCfg = {},
3000+
requestResult,
3001+
callbackWrapper,
3002+
requestHeaders;
3003+
3004+
requestHeaders = cfg.requestHeaders || {};
3005+
3006+
requestCfg = {
3007+
url: "activities",
3008+
method: "GET",
3009+
params: {
3010+
activityId: activityId
3011+
},
3012+
ignore404: true,
3013+
headers: requestHeaders
3014+
};
3015+
3016+
if (typeof cfg.callback !== "undefined") {
3017+
callbackWrapper = function (err, xhr) {
3018+
var result = xhr;
3019+
3020+
if (err === null) {
3021+
//
3022+
// a 404 really shouldn't happen because the LRS can dynamically
3023+
// build the response based on what has been passed to it, but
3024+
// don't have the client fail in the condition that it does, because
3025+
// we can do the same thing
3026+
//
3027+
if (xhr.status === 404) {
3028+
result = new TinCan.Activity(
3029+
{
3030+
id: activityId
3031+
}
3032+
);
3033+
}
3034+
else {
3035+
result = TinCan.Activity.fromJSON(xhr.responseText);
3036+
}
3037+
}
3038+
3039+
cfg.callback(err, result);
3040+
};
3041+
requestCfg.callback = callbackWrapper;
3042+
}
3043+
3044+
requestResult = this.sendRequest(requestCfg);
3045+
if (! callbackWrapper) {
3046+
requestResult.activity = null;
3047+
if (requestResult.err === null) {
3048+
if (requestResult.xhr.status === 404) {
3049+
requestResult.activity = new TinCan.Activity(
3050+
{
3051+
id: activityId
3052+
}
3053+
);
3054+
}
3055+
else {
3056+
requestResult.activity = TinCan.Activity.fromJSON(requestResult.xhr.responseText);
3057+
}
3058+
}
3059+
}
3060+
3061+
return requestResult;
3062+
},
3063+
29873064
/**
29883065
Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
29893066

build/tincan.js

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"0.40.0";
1+
"0.41.0";
22
/*
33
CryptoJS v3.0.2
44
code.google.com/p/crypto-js
@@ -2984,6 +2984,83 @@ TinCan client library
29842984
return this.sendRequest(requestCfg);
29852985
},
29862986

2987+
/**
2988+
Retrieve an activity, when used from a browser sends to the endpoint using the RESTful interface.
2989+
2990+
@method retrieveActivity
2991+
@param {String} activityId id of the Activity to retrieve
2992+
@param {Object} cfg Configuration options
2993+
@param {Function} [cfg.callback] Callback to execute on completion
2994+
@param {Object} [cfg.requestHeaders] Optional object containing additional headers to add to request
2995+
@return {Object} Value retrieved
2996+
*/
2997+
retrieveActivity: function (activityId, cfg) {
2998+
this.log("retrieveActivity");
2999+
var requestCfg = {},
3000+
requestResult,
3001+
callbackWrapper,
3002+
requestHeaders;
3003+
3004+
requestHeaders = cfg.requestHeaders || {};
3005+
3006+
requestCfg = {
3007+
url: "activities",
3008+
method: "GET",
3009+
params: {
3010+
activityId: activityId
3011+
},
3012+
ignore404: true,
3013+
headers: requestHeaders
3014+
};
3015+
3016+
if (typeof cfg.callback !== "undefined") {
3017+
callbackWrapper = function (err, xhr) {
3018+
var result = xhr;
3019+
3020+
if (err === null) {
3021+
//
3022+
// a 404 really shouldn't happen because the LRS can dynamically
3023+
// build the response based on what has been passed to it, but
3024+
// don't have the client fail in the condition that it does, because
3025+
// we can do the same thing
3026+
//
3027+
if (xhr.status === 404) {
3028+
result = new TinCan.Activity(
3029+
{
3030+
id: activityId
3031+
}
3032+
);
3033+
}
3034+
else {
3035+
result = TinCan.Activity.fromJSON(xhr.responseText);
3036+
}
3037+
}
3038+
3039+
cfg.callback(err, result);
3040+
};
3041+
requestCfg.callback = callbackWrapper;
3042+
}
3043+
3044+
requestResult = this.sendRequest(requestCfg);
3045+
if (! callbackWrapper) {
3046+
requestResult.activity = null;
3047+
if (requestResult.err === null) {
3048+
if (requestResult.xhr.status === 404) {
3049+
requestResult.activity = new TinCan.Activity(
3050+
{
3051+
id: activityId
3052+
}
3053+
);
3054+
}
3055+
else {
3056+
requestResult.activity = TinCan.Activity.fromJSON(requestResult.xhr.responseText);
3057+
}
3058+
}
3059+
}
3060+
3061+
return requestResult;
3062+
},
3063+
29873064
/**
29883065
Retrieve an activity profile value, when used from a browser sends to the endpoint using the RESTful interface.
29893066

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tincanjs",
33
"description": "Tin Can API Library",
4-
"version": "0.40.0",
4+
"version": "0.41.0",
55
"private": false,
66
"main": "build/tincan-node.js",
77
"directories": {

0 commit comments

Comments
 (0)