Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/sabre-dev-studio-flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ var SabreDevStudioFlight = (function() {
* @param callback
*/
this.bargain_finder_max = function (request, callback) {
var endpoint = '/v1.8.5/shop/flights';
var endpoint = '/v4/offers/shop/flights';
var options = {
'mode': 'live',
'Content-Type': 'application/json'
'Content-Type': 'application/json',
'enabletagging':true,
'limit':200
};
that.sabre_dev_studio.post(endpoint, request, options, callback);
};
Expand Down Expand Up @@ -243,4 +245,4 @@ var SabreDevStudioFlight = (function() {
return SabreDevStudioFlight;
})();

module.exports = SabreDevStudioFlight;
module.exports.SabreDevStudioFlight = SabreDevStudioFlight;
15 changes: 10 additions & 5 deletions lib/sabre-dev-studio.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ var SabreDevStudio = (function() {
init(options);
function init(options) {
var clientID = function() {
return new Buffer(that.config.client_id).toString('base64');
return Buffer.from(that.config.client_id).toString('base64');
};
var clientSecret = function() {
return new Buffer(that.config.client_secret).toString('base64');
return Buffer.from(that.config.client_secret).toString('base64');
};

var keys = ['client_id', 'client_secret', 'uri', 'access_token'];
Expand Down Expand Up @@ -95,15 +95,20 @@ var SabreDevStudio = (function() {
method: method,
body: post_body,
headers: headers,
timeout: 60 * 10000,
auth: {
"bearer": this.config.access_token
}
};
request[method.toLowerCase()](requestUrl, reqestOptions, function(error, response, data) {
if (error) {
if (error.data === '') { error.data = requestUrl; }
log.error('Error:', error);
cb(error, data, response);
if (error.code === 'ECONNRESET' && retryCount >= 0) {
fetchAccessToken(endpoint, options, cb, --retryCount);
} else {
if (error.data === '') { error.data = requestUrl; }
log.error('Error:', error);
cb(error, data, response);
}
} else if (response.statusCode === 200) {
cb(null, data, response);
} else if (response.statusCode === 401 && retryCount >= 0) {
Expand Down