Comparing version 0.1.11 to 0.1.12
@@ -33,16 +33,11 @@ (function() { | ||
AmazonClient.prototype.validateResponse = function(response, cb) { | ||
var $, error, summary; | ||
try { | ||
$ = load(response, { | ||
normalizeWhitespace: true | ||
}); | ||
summary = $('#summaryLeft'); | ||
return cb(null, { | ||
$: $, | ||
summary: summary | ||
}); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
var $, summary; | ||
$ = load(response, { | ||
normalizeWhitespace: true | ||
}); | ||
summary = $('#summaryLeft'); | ||
return cb(null, { | ||
$: $, | ||
summary: summary | ||
}); | ||
}; | ||
@@ -49,0 +44,0 @@ |
@@ -56,3 +56,3 @@ (function() { | ||
DhlClient.prototype.validateResponse = function(response, cb) { | ||
var error, handleResponse; | ||
var handleResponse; | ||
handleResponse = function(xmlErr, trackResult) { | ||
@@ -79,8 +79,4 @@ var shipment, statusCode, statusDesc, trackStatus, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; | ||
}; | ||
try { | ||
return this.parser.parseString(response, handleResponse); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
this.parser.reset(); | ||
return this.parser.parseString(response, handleResponse); | ||
}; | ||
@@ -87,0 +83,0 @@ |
@@ -73,3 +73,3 @@ (function() { | ||
FedexClient.prototype.validateResponse = function(response, cb) { | ||
var error, handleResponse; | ||
var handleResponse; | ||
handleResponse = function(xmlErr, trackResult) { | ||
@@ -86,12 +86,8 @@ var notifications, success, _ref1, _ref2, _ref3; | ||
if (!success) { | ||
return cb(notifications); | ||
return cb(notifications || 'invalid reply'); | ||
} | ||
return cb(null, (_ref2 = trackResult['TrackReply']) != null ? (_ref3 = _ref2['TrackDetails']) != null ? _ref3[0] : void 0 : void 0); | ||
}; | ||
try { | ||
return this.parser.parseString(response, handleResponse); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
this.parser.reset(); | ||
return this.parser.parseString(response, handleResponse); | ||
}; | ||
@@ -98,0 +94,0 @@ |
@@ -25,15 +25,9 @@ (function() { | ||
LasershipClient.prototype.validateResponse = function(response, cb) { | ||
var error; | ||
try { | ||
response = JSON.parse(response); | ||
if (response['Events'] == null) { | ||
return cb({ | ||
error: 'missing events' | ||
}); | ||
} | ||
return cb(null, response); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
response = JSON.parse(response); | ||
if (response['Events'] == null) { | ||
return cb({ | ||
error: 'missing events' | ||
}); | ||
} | ||
return cb(null, response); | ||
}; | ||
@@ -40,0 +34,0 @@ |
@@ -29,33 +29,28 @@ (function() { | ||
OnTracClient.prototype.validateResponse = function(responses, cb) { | ||
var details, error, summary; | ||
try { | ||
if ((responses != null ? responses.length : void 0) < 2) { | ||
return cb({ | ||
error: "missing data" | ||
}); | ||
} | ||
if (responses[0] == null) { | ||
return cb({ | ||
error: "missing summary" | ||
}); | ||
} | ||
if (responses[1] == null) { | ||
return cb({ | ||
error: "missing details" | ||
}); | ||
} | ||
summary = load(responses[0], { | ||
normalizeWhitespace: true | ||
var details, summary; | ||
if ((responses != null ? responses.length : void 0) < 2) { | ||
return cb({ | ||
error: "missing data" | ||
}); | ||
details = load(responses[1], { | ||
normalizeWhitespace: true | ||
} | ||
if (responses[0] == null) { | ||
return cb({ | ||
error: "missing summary" | ||
}); | ||
return cb(null, { | ||
summary: summary, | ||
details: details | ||
} | ||
if (responses[1] == null) { | ||
return cb({ | ||
error: "missing details" | ||
}); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
summary = load(responses[0], { | ||
normalizeWhitespace: true | ||
}); | ||
details = load(responses[1], { | ||
normalizeWhitespace: true | ||
}); | ||
return cb(null, { | ||
summary: summary, | ||
details: details | ||
}); | ||
}; | ||
@@ -62,0 +57,0 @@ |
@@ -61,3 +61,3 @@ (function() { | ||
UpsClient.prototype.validateResponse = function(response, cb) { | ||
var error, handleResponse; | ||
var handleResponse; | ||
handleResponse = function(xmlErr, trackResult) { | ||
@@ -84,8 +84,4 @@ var error, errorMsg, responseStatus, shipment, _ref10, _ref11, _ref12, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9; | ||
}; | ||
try { | ||
return this.parser.parseString(response, handleResponse); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
this.parser.reset(); | ||
return this.parser.parseString(response, handleResponse); | ||
}; | ||
@@ -92,0 +88,0 @@ |
@@ -33,20 +33,15 @@ (function() { | ||
UpsMiClient.prototype.validateResponse = function(response, cb) { | ||
var $, error, miDetails, summary, uspsDetails, _ref1; | ||
try { | ||
$ = load(response, { | ||
normalizeWhitespace: true | ||
}); | ||
summary = (_ref1 = $('#Table6').find('table')) != null ? _ref1[0] : void 0; | ||
uspsDetails = $('#ctl00_mainContent_ctl00_pnlUSPS > table'); | ||
miDetails = $('#ctl00_mainContent_ctl00_pnlMI > table'); | ||
return cb(null, { | ||
$: $, | ||
summary: summary, | ||
uspsDetails: uspsDetails, | ||
miDetails: miDetails | ||
}); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
var $, miDetails, summary, uspsDetails, _ref1; | ||
$ = load(response, { | ||
normalizeWhitespace: true | ||
}); | ||
summary = (_ref1 = $('#Table6').find('table')) != null ? _ref1[0] : void 0; | ||
uspsDetails = $('#ctl00_mainContent_ctl00_pnlUSPS > table'); | ||
miDetails = $('#ctl00_mainContent_ctl00_pnlMI > table'); | ||
return cb(null, { | ||
$: $, | ||
summary: summary, | ||
uspsDetails: uspsDetails, | ||
miDetails: miDetails | ||
}); | ||
}; | ||
@@ -53,0 +48,0 @@ |
@@ -55,3 +55,3 @@ (function() { | ||
UspsClient.prototype.validateResponse = function(response, cb) { | ||
var error, handleResponse; | ||
var handleResponse; | ||
handleResponse = function(xmlErr, trackResult) { | ||
@@ -65,8 +65,4 @@ var trackInfo, _ref2, _ref3; | ||
}; | ||
try { | ||
return this.parser.parseString(response, handleResponse); | ||
} catch (_error) { | ||
error = _error; | ||
return console.log("WARNING: parse error: " + (JSON.stringify(error))); | ||
} | ||
this.parser.reset(); | ||
return this.parser.parseString(response, handleResponse); | ||
}; | ||
@@ -73,0 +69,0 @@ |
{ | ||
"name": "shipit", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "This module allows you to connect to many shipping carriers like UPS and FedEx and download tracking data for your packages in a common schema", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74991
1666