comprodls-sdk 2.113.0-thor.1 → 2.115.0
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 +73 -278
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +2 -9
- package/lib/helpers/lib/errors.js +1 -3
- package/lib/services/analytics/index.js +1 -83
- package/lib/services/auth/index.js +33 -28
- package/lib/services/integrations/index.js +1 -39
- package/lib/services/spaces/index.js +29 -36
- package/lib/services/spacesextn/index.js +1 -46
- package/lib/services/xapi/index.js +1 -31
- package/package.json +1 -1
package/lib/config/index.js
CHANGED
|
@@ -154,7 +154,6 @@ exports.AUTH_API_URLS = {
|
|
|
154
154
|
validateSpaceCode: '/accounts/{accountid}/space-code/validate',
|
|
155
155
|
validateClassCode: '/accounts/{accountid}/class-code/validate',
|
|
156
156
|
joinInstituteSpace: '/accounts/{accountid}/join-institute-space',
|
|
157
|
-
provisionStudentInInstitutionalSpace: '/accounts/{accountid}/student/join-institute-space',
|
|
158
157
|
provisionSpacesToStudent: '/accounts/{accountId}/student/provision-spaces',
|
|
159
158
|
provisionSpacesToTeacher: '/accounts/{accountId}/teacher/provision-spaces',
|
|
160
159
|
shadowProvision: '/org/{orgId}/shadow-provision',
|
|
@@ -237,7 +236,6 @@ exports.AUTHEXTN_API_URLS = {
|
|
|
237
236
|
|
|
238
237
|
//Space related API
|
|
239
238
|
entitleBulkUsersToProducts: '/accounts/{accountid}/entitle-users/bulk',
|
|
240
|
-
deleteUserAccount : '/accounts/{accountid}/ext-users/{ext_user_id}',
|
|
241
239
|
|
|
242
240
|
// Assigned Path APIs
|
|
243
241
|
userAssignedPaths: '/org/{orgid}/classes/{classid}/assigned-paths/{assignedpathid}/enroll-user/multi',
|
|
@@ -281,11 +279,7 @@ exports.ANALYTICS_API_URLS = {
|
|
|
281
279
|
getClassCustomComponentUserSubmission: '/{orgId}/class/custom-component/class-record/evaluations',
|
|
282
280
|
|
|
283
281
|
//CrossProductAggregation Related APIs
|
|
284
|
-
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
|
|
285
|
-
|
|
286
|
-
// MAP Aggregation Related APIs
|
|
287
|
-
getStudentAggregation: '/{orgId}/student/aggregation',
|
|
288
|
-
getTeacherAggregation: '/{orgId}/teacher/aggregation'
|
|
282
|
+
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
|
|
289
283
|
};
|
|
290
284
|
|
|
291
285
|
exports.PRODUCT_API_URLS = {
|
|
@@ -339,8 +333,7 @@ exports.INTEGRATIONS_API_URLS = {
|
|
|
339
333
|
auditTrail: '/accounts/{accountId}/audit-trail',
|
|
340
334
|
customEvents: '/accounts/{accountId}/custom-events',
|
|
341
335
|
schedules: '/accounts/{accountId}/context/{context}/schedule',
|
|
342
|
-
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
343
|
-
lifecycleEvents: '/accounts/{accountId}/lifecycle-events'
|
|
336
|
+
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
344
337
|
};
|
|
345
338
|
|
|
346
339
|
exports.DRIVE_API_URLS = {
|
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
var ERROR_TYPES = {
|
|
28
28
|
API_ERROR: 'API_ERROR',
|
|
29
29
|
SDK_ERROR: 'SDK_ERROR',
|
|
30
|
-
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
31
|
-
UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
|
|
32
|
-
POLLING_INITIATION: 'POLLING_INITIATION'
|
|
30
|
+
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
var ERROR_CATEGORY = {
|
|
@@ -27,7 +27,6 @@ var q = require('q');
|
|
|
27
27
|
var request = require('superagent');
|
|
28
28
|
var Agent = require('agentkeepalive');
|
|
29
29
|
|
|
30
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
31
30
|
var helpers = require('../../helpers');
|
|
32
31
|
var DLSError = helpers.errors.DLSError;
|
|
33
32
|
|
|
@@ -74,11 +73,7 @@ function analytics() {
|
|
|
74
73
|
getClassCustomComponentUserSubmission: getClassCustomComponentUserSubmission.bind(this),
|
|
75
74
|
|
|
76
75
|
//CrossProductAggregation Related APIs
|
|
77
|
-
getCrossProductAggregation: getCrossProductAggregation.bind(this)
|
|
78
|
-
|
|
79
|
-
//MAP Aggregation Related APIs
|
|
80
|
-
getStudentAggregation: getStudentAggregation.bind(this),
|
|
81
|
-
getTeacherAggregation: getTeacherAggregation.bind(this)
|
|
76
|
+
getCrossProductAggregation: getCrossProductAggregation.bind(this)
|
|
82
77
|
};
|
|
83
78
|
}
|
|
84
79
|
|
|
@@ -1368,80 +1363,3 @@ function getCrossProductAggregation(options) {
|
|
|
1368
1363
|
}
|
|
1369
1364
|
return dfd.promise;
|
|
1370
1365
|
}
|
|
1371
|
-
|
|
1372
|
-
/**
|
|
1373
|
-
* Wiki Link for SDK params
|
|
1374
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getstudentaggregationparams
|
|
1375
|
-
*/
|
|
1376
|
-
function getStudentAggregation(options) {
|
|
1377
|
-
var self = this;
|
|
1378
|
-
|
|
1379
|
-
let err = {};
|
|
1380
|
-
|
|
1381
|
-
// Validations
|
|
1382
|
-
if(!(options && options.studentid && options.courseid)) {
|
|
1383
|
-
err.message = err.description = 'Mandatory params: studentid/courseid' +
|
|
1384
|
-
' not found in request options.';
|
|
1385
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
1386
|
-
} else {
|
|
1387
|
-
// Passed all validations, Constructing URL
|
|
1388
|
-
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
1389
|
-
self.config.ANALYTICS_API_URLS.getStudentAggregation;
|
|
1390
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
1391
|
-
|
|
1392
|
-
// Setup Query Params
|
|
1393
|
-
var queryParams = { courseId: options.courseid, studentId: options.studentid };
|
|
1394
|
-
|
|
1395
|
-
// Prepare request parameters & execute request
|
|
1396
|
-
let reqOptions = {
|
|
1397
|
-
params: queryParams,
|
|
1398
|
-
headers: { traceid: self.traceid, token: self.token }
|
|
1399
|
-
};
|
|
1400
|
-
return requestLayer.get(url, reqOptions)
|
|
1401
|
-
.then(function (response) {
|
|
1402
|
-
return response.body;
|
|
1403
|
-
})
|
|
1404
|
-
.catch(function (err) {
|
|
1405
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
|
-
/**
|
|
1412
|
-
* Wiki Link for SDK params
|
|
1413
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getteacheraggregationparams
|
|
1414
|
-
*/
|
|
1415
|
-
function getTeacherAggregation(options) {
|
|
1416
|
-
var self = this;
|
|
1417
|
-
|
|
1418
|
-
let err = {};
|
|
1419
|
-
|
|
1420
|
-
// Validations
|
|
1421
|
-
if(!(options && options.teacherid)) {
|
|
1422
|
-
err.message = err.description = 'Mandatory params: teacherid not found in request options.';
|
|
1423
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
1424
|
-
} else {
|
|
1425
|
-
// Passed all validations, Constructing URL
|
|
1426
|
-
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
1427
|
-
self.config.ANALYTICS_API_URLS.getTeacherAggregation;
|
|
1428
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
1429
|
-
|
|
1430
|
-
// Setup Query Params
|
|
1431
|
-
var queryParams = { teacherId: options.teacherid, studentId: options.studentid };
|
|
1432
|
-
|
|
1433
|
-
// Prepare request parameters & execute request
|
|
1434
|
-
let reqOptions = {
|
|
1435
|
-
params: queryParams,
|
|
1436
|
-
headers: { traceid: self.traceid, token: self.token }
|
|
1437
|
-
};
|
|
1438
|
-
return requestLayer.get(url, reqOptions)
|
|
1439
|
-
.then(function (response) {
|
|
1440
|
-
return response.body;
|
|
1441
|
-
})
|
|
1442
|
-
.catch(function (err) {
|
|
1443
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
}
|
|
@@ -29,7 +29,6 @@ var Agent = require('agentkeepalive');
|
|
|
29
29
|
|
|
30
30
|
var helpers = require('../../helpers');
|
|
31
31
|
var converter = require('../../helpers/lib/api/converter');
|
|
32
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
33
32
|
|
|
34
33
|
var DLSError = helpers.errors.DLSError;
|
|
35
34
|
|
|
@@ -177,37 +176,43 @@ function getUserProfile(options) {
|
|
|
177
176
|
*/
|
|
178
177
|
function deleteUserProfile(options) {
|
|
179
178
|
var self = this;
|
|
179
|
+
var dfd = q.defer();
|
|
180
180
|
|
|
181
|
-
//
|
|
182
|
-
var
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (!(options && options.userid)) {
|
|
188
|
-
var err = {};
|
|
189
|
-
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
190
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
191
|
-
}
|
|
181
|
+
// Validations
|
|
182
|
+
var err = helpers.validations.isAuthenticated(self.orgId, self.token);
|
|
183
|
+
if(err) { dfd.reject(err); }
|
|
184
|
+
else {
|
|
185
|
+
if (options.userid) {
|
|
186
|
+
var userid = options.userid;
|
|
192
187
|
|
|
188
|
+
// Passed all validations, Contruct API url
|
|
189
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
190
|
+
self.config.AUTH_API_URLS.userInfoAPI;
|
|
191
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId, userId: userid });
|
|
193
192
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
193
|
+
// Setup request with URL
|
|
194
|
+
var requestAPI = request.delete(url);
|
|
195
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
196
|
+
|
|
197
|
+
// Setup token in Authorization header
|
|
198
|
+
requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
|
|
199
|
+
|
|
200
|
+
// Call DELETE USER API
|
|
201
|
+
requestAPI.end(function (error, response) {
|
|
202
|
+
if (error) {
|
|
203
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
204
|
+
dfd.reject(error);
|
|
205
|
+
}
|
|
206
|
+
else { dfd.resolve(response.body); }
|
|
207
|
+
});
|
|
208
|
+
} else {
|
|
209
|
+
err = {};
|
|
210
|
+
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
211
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
212
|
+
dfd.reject(err);
|
|
213
|
+
}
|
|
202
214
|
}
|
|
203
|
-
|
|
204
|
-
return requestLayer.delete(url, reqOptions)
|
|
205
|
-
.then(function (response) {
|
|
206
|
-
return response.body;
|
|
207
|
-
})
|
|
208
|
-
.catch(function (err) {
|
|
209
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
210
|
-
});
|
|
215
|
+
return dfd.promise;
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
/**
|
|
@@ -27,7 +27,6 @@ var q = require('q');
|
|
|
27
27
|
var request = require('superagent');
|
|
28
28
|
var Agent = require('agentkeepalive');
|
|
29
29
|
|
|
30
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
31
30
|
var helpers = require('../../helpers');
|
|
32
31
|
var converter = require('../../helpers/lib/api/converter');
|
|
33
32
|
|
|
@@ -53,8 +52,7 @@ function integrations(accountId) {
|
|
|
53
52
|
createSchedule: createSchedule.bind(this),
|
|
54
53
|
getSchedule: getSchedule.bind(this),
|
|
55
54
|
updateSchedule: updateSchedule.bind(this),
|
|
56
|
-
deleteSchedule: deleteSchedule.bind(this)
|
|
57
|
-
publishLifecycleEvent: publishLifecycleEvent.bind(this)
|
|
55
|
+
deleteSchedule: deleteSchedule.bind(this)
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
58
|
|
|
@@ -480,39 +478,3 @@ function deleteSchedule(options) {
|
|
|
480
478
|
|
|
481
479
|
return deferred.promise;
|
|
482
480
|
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Wiki Link for SDK params
|
|
486
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publishlifecycleeventparams
|
|
487
|
-
*/
|
|
488
|
-
function publishLifecycleEvent(options) {
|
|
489
|
-
let self = this;
|
|
490
|
-
|
|
491
|
-
// Validate productcode
|
|
492
|
-
if (!(options && options.category && options.action && options.timestamp &&
|
|
493
|
-
options.data && options.ext_actor_id)) {
|
|
494
|
-
let err = {};
|
|
495
|
-
err.message = err.description = 'Mandatory params: category/action/timestamp' +
|
|
496
|
-
'/data/ext_actor_id not found in request options.';
|
|
497
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// Construct API URL
|
|
501
|
-
let url = helpers.api.constructAPIUrl(
|
|
502
|
-
self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.lifecycleEvents,
|
|
503
|
-
{ accountId: self.accountId }
|
|
504
|
-
);
|
|
505
|
-
|
|
506
|
-
// Prepare request parameters & execute request
|
|
507
|
-
let reqOptions = {
|
|
508
|
-
params: options,
|
|
509
|
-
headers: { traceid: self.traceid }
|
|
510
|
-
};
|
|
511
|
-
return requestLayer.post(url, reqOptions)
|
|
512
|
-
.then(function (response) {
|
|
513
|
-
return response.body;
|
|
514
|
-
})
|
|
515
|
-
.catch(function (err) {
|
|
516
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
517
|
-
});
|
|
518
|
-
}
|
|
@@ -277,45 +277,39 @@ function changeSpaceCode(options) {
|
|
|
277
277
|
*/
|
|
278
278
|
function joinInstituteSpace(options) {
|
|
279
279
|
var self = this;
|
|
280
|
+
// Initializing promise
|
|
281
|
+
var dfd = q.defer();
|
|
280
282
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
292
|
-
}
|
|
293
|
-
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
283
|
+
if(options && options.ext_user_id &&
|
|
284
|
+
options.ext_role && options.space_code)
|
|
285
|
+
{
|
|
286
|
+
// Passed all validations, Contruct API url
|
|
287
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
288
|
+
self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
289
|
+
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
294
290
|
|
|
295
|
-
|
|
296
|
-
|
|
291
|
+
// Setup request with URL and Params
|
|
292
|
+
var requestAPI = request.post(url)
|
|
297
293
|
.set('Content-Type', 'application/json')
|
|
298
|
-
.set('Accept', 'application/json')
|
|
299
|
-
|
|
294
|
+
.set('Accept', 'application/json')
|
|
295
|
+
.send(options);
|
|
296
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
300
297
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
reject(err);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
298
|
+
requestAPI.end(function(error, response) {
|
|
299
|
+
if(error) {
|
|
300
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
301
|
+
dfd.reject(err);
|
|
302
|
+
}
|
|
303
|
+
else { dfd.resolve(response.body); }
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
var err = {};
|
|
307
|
+
err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
|
|
308
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
309
|
+
dfd.reject(err);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return dfd.promise;
|
|
319
313
|
}
|
|
320
314
|
|
|
321
315
|
/**
|
|
@@ -855,7 +849,6 @@ function updateUserInformation(options) {
|
|
|
855
849
|
};
|
|
856
850
|
if(options.ref_id) { bodyParams.ref_id = options.ref_id; }
|
|
857
851
|
if(options.ext_email) { bodyParams.ext_email = options.ext_email; }
|
|
858
|
-
if(options.ext_username) { bodyParams.ext_username = options.ext_username; }
|
|
859
852
|
if(options.ext_first_name) { bodyParams.ext_first_name = options.ext_first_name; }
|
|
860
853
|
if(options.ext_last_name) { bodyParams.ext_last_name = options.ext_last_name; }
|
|
861
854
|
if(options.address) { bodyParams.address = options.address; }
|
|
@@ -42,8 +42,7 @@ function spacesextn(accountId) {
|
|
|
42
42
|
this.accountId = accountId;
|
|
43
43
|
return {
|
|
44
44
|
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
|
|
45
|
-
setupUser: setupUser.bind(this)
|
|
46
|
-
deleteUserAccount : deleteUserAccount.bind(this)
|
|
45
|
+
setupUser: setupUser.bind(this)
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -130,47 +129,3 @@ function setupUser(options) {
|
|
|
130
129
|
}
|
|
131
130
|
return deferred.promise;
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Wiki Link for SDK params
|
|
136
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
|
|
137
|
-
*/
|
|
138
|
-
function deleteUserAccount(options) {
|
|
139
|
-
var self = this;
|
|
140
|
-
return new Promise(function(resolve, reject) {
|
|
141
|
-
|
|
142
|
-
if (options.ext_user_id && options.body) {
|
|
143
|
-
//Passed all validations, Contruct API url
|
|
144
|
-
var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
|
|
145
|
-
self.config.AUTHEXTN_API_URLS.deleteUserAccount;
|
|
146
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
147
|
-
accountid: self.accountId,
|
|
148
|
-
ext_user_id: options.ext_user_id,
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// Setup request
|
|
152
|
-
var requestAPI = request.delete(url)
|
|
153
|
-
.set('Content-Type', 'application/json')
|
|
154
|
-
.set('Accept', 'application/json');
|
|
155
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
156
|
-
|
|
157
|
-
requestAPI
|
|
158
|
-
.send(options.body)
|
|
159
|
-
.agent(keepaliveAgent)
|
|
160
|
-
.end(function(error, response) {
|
|
161
|
-
if (error) {
|
|
162
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
163
|
-
reject(err);
|
|
164
|
-
} else {
|
|
165
|
-
resolve(response.body);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
} else {
|
|
169
|
-
var err = {};
|
|
170
|
-
err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
|
|
171
|
-
err.message = err.description;
|
|
172
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
173
|
-
reject(err);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
@@ -38,8 +38,7 @@ function xapi(accountId) {
|
|
|
38
38
|
this.accountId = accountId;
|
|
39
39
|
return {
|
|
40
40
|
postStatement: postStatements.bind(this),
|
|
41
|
-
postExternalStatements: postExternalStatements.bind(this)
|
|
42
|
-
postSchoolStatement: postSchoolStatements.bind(this)
|
|
41
|
+
postExternalStatements: postExternalStatements.bind(this)
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -113,32 +112,3 @@ function postExternalStatements(options) {
|
|
|
113
112
|
});
|
|
114
113
|
return dfd.promise;
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Wiki Link for SDK params
|
|
119
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/08_XAPI-Adapter#postschoolstatementsparams
|
|
120
|
-
*/
|
|
121
|
-
function postSchoolStatements(options) {
|
|
122
|
-
var self = this;
|
|
123
|
-
var dfd = q.defer();
|
|
124
|
-
|
|
125
|
-
var url = self.config.DEFAULT_HOSTS.XAPI + self.config.XAPI_API_URLS.postSchoolStatements;
|
|
126
|
-
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
127
|
-
//Passed all validations, Construct API url
|
|
128
|
-
|
|
129
|
-
//Setup request with URL and Params
|
|
130
|
-
var requestAPI = request.post(url).send(options);
|
|
131
|
-
|
|
132
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
133
|
-
|
|
134
|
-
//Call Product Timespent Api
|
|
135
|
-
|
|
136
|
-
requestAPI.end(function(err, response) {
|
|
137
|
-
if(err) {
|
|
138
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
139
|
-
dfd.reject(err);
|
|
140
|
-
}
|
|
141
|
-
else { dfd.resolve(response.body); }
|
|
142
|
-
});
|
|
143
|
-
return dfd.promise;
|
|
144
|
-
}
|
package/package.json
CHANGED