comprodls-sdk 2.102.1-qa → 2.104.0-qa.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.
@@ -27,6 +27,7 @@ var q = require('q');
27
27
  var request = require('superagent');
28
28
 
29
29
  var helpers = require('../../helpers');
30
+ var requestLayer = require('../../helpers/lib/requestLayer');
30
31
 
31
32
  var DLSError = helpers.errors.DLSError;
32
33
 
@@ -48,34 +49,33 @@ function superuser(accountId) {
48
49
  */
49
50
  function getAllInstitutions(options) {
50
51
  var self = this;
51
- // Initializing promise
52
- var dfd = q.defer();
53
52
 
54
- var url = self.config.DEFAULT_HOSTS.AUTH +
55
- self.config.AUTH_API_URLS.getAllInstitutions;
56
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
53
+ var url = helpers.api.constructAPIUrl(
54
+ self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllInstitutions,
55
+ { accountid : self.accountId }
56
+ );
57
57
 
58
58
  var params = {};
59
- if(options) {
60
- if(options.lookup) { params.lookup = options.lookup; }
61
- if(options.cursor) { params.cursor = options.cursor; }
62
- if(options.limit) { params.limit = options.limit; }
59
+ if (options) {
60
+ if (options.lookup) { params.lookup = options.lookup; }
61
+ if (options.country) { params.country = options.country; }
62
+ if (options.cursor) { params.cursor = options.cursor; }
63
+ if (options.start) { params.start = options.start; }
64
+ if (options.end) { params.end = options.end; }
63
65
  }
64
66
 
65
- //Setup request with URL and Params
66
- var requestAPI = request.get(url).query(params);
67
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
68
-
69
- requestAPI.end(function(err, response) {
70
- if(err) {
71
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
72
- dfd.reject(err);
73
- } else {
74
- dfd.resolve(response.body);
75
- }
67
+ // Prepare request parameters & execute request
68
+ var reqOptions = {
69
+ params: params,
70
+ headers: { traceid: self.traceid }
71
+ };
72
+ return requestLayer.get(url, reqOptions)
73
+ .then(function (response) {
74
+ return response.body;
75
+ })
76
+ .catch(function (err) {
77
+ throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
76
78
  });
77
-
78
- return dfd.promise;
79
79
  }
80
80
 
81
81
  /**
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.102.1-qa",
4
+ "version": "2.104.0-qa.1",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"