cdyne-address
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -66,2 +66,3 @@ var request = require('request'), | ||
_this = this; | ||
parameters = extend(parameters, credentials); // Add credentials to params | ||
@@ -76,7 +77,11 @@ | ||
if (!body || body.ReturnCode === 1 || body.ReturnCode === 2 || body.ReturnCode === 10 ) { | ||
var errorDescription; | ||
var errorDescription, | ||
errorName; | ||
if (body){ | ||
errorDescription = _this._getReturnCodeInfo(body.ReturnCode); | ||
errorName = body.ReturnCode; | ||
} else { | ||
errorDescription = 'Server unavailable.'; | ||
errorName = 'Server Error'; | ||
} | ||
@@ -86,3 +91,3 @@ | ||
error = new Error(errorDescription); | ||
error.name = body.ReturnCode; | ||
error.name = errorName; | ||
@@ -89,0 +94,0 @@ return callback(error); |
{ | ||
"name": "cdyne-address", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "CDYNE Postal Address Verification API node.js wrapper", | ||
@@ -5,0 +5,0 @@ "main": "./lib/cdyne-address.js", |
@@ -5,2 +5,4 @@ cdyne-address | ||
See the official [CDYNE PAV Specsheet](http://cdyne.com/downloads/CDYNE_Postal_Verification_SPECS_2010.pdf) for more detailed documentation. | ||
##Installation | ||
@@ -21,12 +23,16 @@ This module is published in NPM | ||
##Methods | ||
###verifyAddress | ||
`verifyAddress` accepts a U.S. or Canadian address as input and returns a corrected, standardized address, with geolocation, mailing industry, and census data. The service will try to match the input to USPS address data even when the provided information is misspelled or missing. | ||
```js | ||
verifyAddress(primaryLine, secondaryLine, city, state, zip, options, callback) | ||
verifyAddress(primaryAddressLine, secondaryAddressLine, city, state, zip, options, callback) | ||
``` | ||
``` | ||
```js | ||
client.verifyAddress('111 Grandby St', '', 'Norfolk', 'VA', '23510', { | ||
// options | ||
ReturnGeoLocation: true | ||
}, function(error, data) { | ||
console.log(error, data); | ||
console.log(data); | ||
}); | ||
@@ -36,3 +42,3 @@ ``` | ||
Example Response (some fields omitted for brevity) | ||
```bash | ||
```js | ||
{ | ||
@@ -63,1 +69,16 @@ CityName: 'NORFOLK', | ||
``` | ||
###options | ||
The `options` parameter expects an object. Options will allow additional information about the address to be returned, if available. | ||
```js | ||
// Possible options | ||
{ | ||
"ReturnCaseSensitive": true, // turn off default “all uppercase” return of street names. | ||
"ReturnCensusInfo": true, | ||
"ReturnCityAbbreviation": true, | ||
"ReturnGeoLocation": true, | ||
"ReturnLegislativeInfo": true, | ||
"ReturnMailingIndustryInfo": true, | ||
"ReturnResidentialIndicator": true, | ||
"ReturnStreetAbbreviated": true, | ||
} | ||
``` |
7278
127
81