comprodls-sdk 2.45.0 → 2.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/comprodls-sdk.js +50 -3
- package/dist/comprodls-sdk.min.js +20 -20
- package/lib/config/index.js +2 -1
- package/lib/services/attempts/index.js +48 -1
- package/package.json +1 -1
package/dist/comprodls-sdk.js
CHANGED
|
@@ -465,7 +465,8 @@ exports.ATTEMPTS_API_URLS = {
|
|
|
465
465
|
getUserAttemptStatsForActivity: '/org/{orgId}/user/{userId}/activities/{activityId}/attempts/stats',
|
|
466
466
|
getUserAttemptForActivity: '/org/{orgId}/user/{userId}/activities/{activityId}/attempts/{attemptId}',
|
|
467
467
|
getUserFirstAttemptForActivity: '/org/{orgId}/user/{userId}/activities/{activityId}/attempts/first',
|
|
468
|
-
getUserLastAttemptForActivity: '/org/{orgId}/user/{userId}/activities/{activityId}/attempts/last'
|
|
468
|
+
getUserLastAttemptForActivity: '/org/{orgId}/user/{userId}/activities/{activityId}/attempts/last',
|
|
469
|
+
getUserActivityMeta: '/org/{orgId}/user/{userId}/activities/{activityId}/meta'
|
|
469
470
|
};
|
|
470
471
|
|
|
471
472
|
exports.PUB_API_URLS = {
|
|
@@ -3870,7 +3871,8 @@ function attempts() {
|
|
|
3870
3871
|
getUserAttemptForActivity: getUserAttemptForActivity.bind(this),
|
|
3871
3872
|
getUserFirstAttemptForActivity: getUserFirstAttemptForActivity.bind(this),
|
|
3872
3873
|
getUserLastAttemptForActivity: getUserLastAttemptForActivity.bind(this),
|
|
3873
|
-
updateUserAttemptForActivity: updateUserAttemptForActivity.bind(this)
|
|
3874
|
+
updateUserAttemptForActivity: updateUserAttemptForActivity.bind(this),
|
|
3875
|
+
getUserActivityMeta: getUserActivityMeta.bind(this)
|
|
3874
3876
|
};
|
|
3875
3877
|
}
|
|
3876
3878
|
|
|
@@ -4214,7 +4216,52 @@ function updateUserAttemptForActivity(options) {
|
|
|
4214
4216
|
}
|
|
4215
4217
|
return dfd.promise;
|
|
4216
4218
|
}
|
|
4217
|
-
|
|
4219
|
+
|
|
4220
|
+
/*
|
|
4221
|
+
options = {
|
|
4222
|
+
userid: 'string', //mandatory
|
|
4223
|
+
activityid: 'string', //mandatory
|
|
4224
|
+
classid: 'string', //mandatory with assignmentid
|
|
4225
|
+
assignmentid: 'string'
|
|
4226
|
+
}
|
|
4227
|
+
*/
|
|
4228
|
+
function getUserActivityMeta(options) {
|
|
4229
|
+
var self = this;
|
|
4230
|
+
var dfd = q.defer();
|
|
4231
|
+
var err;
|
|
4232
|
+
|
|
4233
|
+
if(options && options.userid && options.activityid) {
|
|
4234
|
+
//Passed all validations, Construct API url
|
|
4235
|
+
var url = self.config.DEFAULT_HOSTS.ATTEMPTS + self.config.ATTEMPTS_API_URLS.getUserActivityMeta;
|
|
4236
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId, userId: options.userid, activityId: options.activityid });
|
|
4237
|
+
|
|
4238
|
+
// Contruct parameters
|
|
4239
|
+
var params = {};
|
|
4240
|
+
if(options.classid) { params.classid = options.classid; }
|
|
4241
|
+
if(options.assignmentid) { params.assignmentid = options.assignmentid; }
|
|
4242
|
+
|
|
4243
|
+
//Setup request with URL and Params
|
|
4244
|
+
var requestAPI = request.get(url).query(params);
|
|
4245
|
+
|
|
4246
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
4247
|
+
|
|
4248
|
+
requestAPI.end(function (err, response) {
|
|
4249
|
+
if (err) {
|
|
4250
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
4251
|
+
dfd.reject(err);
|
|
4252
|
+
}
|
|
4253
|
+
else { dfd.resolve(response.body); }
|
|
4254
|
+
});
|
|
4255
|
+
}
|
|
4256
|
+
else {
|
|
4257
|
+
err = {};
|
|
4258
|
+
err.message = err.description = 'Mandatory params - userid or activityid ' +
|
|
4259
|
+
'not found in request options.';
|
|
4260
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
4261
|
+
dfd.reject(err);
|
|
4262
|
+
}
|
|
4263
|
+
return dfd.promise;
|
|
4264
|
+
}
|
|
4218
4265
|
},{"../../helpers":3,"q":58,"superagent":88}],16:[function(require,module,exports){
|
|
4219
4266
|
/*************************************************************************
|
|
4220
4267
|
*
|