comprodls-sdk 2.30.4 → 2.31.2

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.
@@ -69,6 +69,7 @@ function auth() {
69
69
  createClass: createClass.bind(this),
70
70
  updateClass: updateClass.bind(this),
71
71
  createMultipleClasses: createMultipleClasses.bind(this),
72
+ deleteClass: deleteClass.bind(this),
72
73
  cloneClass: cloneClass.bind(this),
73
74
  getAllClasses: getAllClasses.bind(this),
74
75
  getParticularClass: getParticularClass.bind(this),
@@ -1835,6 +1836,49 @@ function createMultipleClasses(options) {
1835
1836
  return dfd.promise;
1836
1837
  }
1837
1838
 
1839
+ /**
1840
+ * @param {*classid: <string>,
1841
+ * *body:{ audit: <boolean> }
1842
+ * } options
1843
+ */
1844
+ function deleteClass(options) {
1845
+ var self = this;
1846
+ var dfd = q.defer();
1847
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
1848
+ if(err) { dfd.reject(err); }
1849
+ else if(options && options.classid && options.body) {
1850
+ // Passed all validations, Contruct API url
1851
+ var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.specificClass;
1852
+ url = helpers.api.constructAPIUrl(url, { orgId: self.orgId, classId: options.classid });
1853
+
1854
+ // Setup request with URL and Params
1855
+ var requestAPI = request.delete(url)
1856
+ .set('Content-Type', 'application/json')
1857
+ .set('Accept', 'application/json')
1858
+ .send(options.body);
1859
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
1860
+
1861
+ //Setup token in Authorization header
1862
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
1863
+
1864
+ requestAPI.end(function (error, response) {
1865
+ if(error) {
1866
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
1867
+ dfd.reject(err);
1868
+ }
1869
+ else { dfd.resolve(response.body); }
1870
+ });
1871
+ }
1872
+ else {
1873
+ err = {};
1874
+ err.message = err.description = 'Mandatory params - classid or body' +
1875
+ ' not found in request options.';
1876
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
1877
+ dfd.reject(err);
1878
+ }
1879
+ return dfd.promise;
1880
+ }
1881
+
1838
1882
  /*
1839
1883
  options = {
1840
1884
  "classid": "classid", //mandatory
@@ -55,7 +55,8 @@ function pushX() {
55
55
  **********************************/
56
56
 
57
57
  function _connect(pubnubCW, options) {
58
- if (!options.userid) {
58
+ var bpubnubV7 = false; // If pubnub v7 or higher in package.json, set it true
59
+ if (bpubnubV7 && !options.userid) {
59
60
  var err = {};
60
61
  err.message = err.description = 'Mandatory parameter userid not found in request options.';
61
62
  err = new DLSError(helpers.errors.ERROR_TYPES.PUSHX_ERROR, err);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "comprodls-sdk",
3
3
  "description": "comproDLS SDK for JavaScript",
4
- "version": "2.30.4",
4
+ "version": "2.31.2",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"
@@ -20,7 +20,7 @@
20
20
  "tincanjs": "^0.50.0",
21
21
  "underscore": "1.8.3",
22
22
  "validate.js": "^0.9.0",
23
- "pubnub": "7.0.1",
23
+ "pubnub": "4.24.2",
24
24
  "agentkeepalive": "4.2.0"
25
25
  },
26
26
  "devDependencies": {