smartystreets-javascript-sdk
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -11,6 +11,17 @@ const SmartyStreetsSDK = require("../index"); | ||
// Documentation for input fields can be found at: | ||
// https://smartystreets.com/docs/cloud/international-street-api#http-input-fields | ||
let lookup1 = new Lookup("CA", "262 Browndale Cr, Richmond Hill, ON"); | ||
let lookup2 = new Lookup(); | ||
lookup2.inputId = "ID-8675309"; | ||
lookup2.geocode = false; | ||
lookup2.organization = "John Doe"; | ||
lookup2.address1 = "Rua Padre Antonio D'Angelo 121"; | ||
lookup2.address2 = "Casa Verde"; | ||
lookup2.locality = "Sao Paulo"; | ||
lookup2.administrativeArea = "SP"; | ||
lookup2.country = "Brazil"; | ||
lookup2.freeform = "Rua Padre Antonio D’Angelo 121 Casa Verde, Sao Paulo"; | ||
lookup2.postalCode = "02516-050"; | ||
@@ -17,0 +28,0 @@ client.send(lookup1) |
@@ -7,6 +7,15 @@ const SmartyStreetsSDK = require("../index"); | ||
// let authId = process.env.SMARTY_AUTH_ID; | ||
// let authToken = process.env.SMARTY_AUTH_TOKEN; | ||
let clientBuilder = new SmartyStreetsCore.ClientBuilder(new SmartyStreetsCore.SharedCredentials(websiteKey)); | ||
// let clientBuilder = new SmartyStreetsCore.ClientBuilder(new SmartyStreetsCore.StaticCredentials(authId, authToken)); | ||
let client = clientBuilder.buildUsAutocompleteClient(); | ||
let lookup = new Lookup("1080 Pasito"); | ||
// Documentation for input fields can be found at: | ||
// https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields | ||
let lookup = new Lookup("4770 Lincoln Ave O"); | ||
client.send(lookup) | ||
@@ -16,4 +25,16 @@ .then(logSuggestions) | ||
lookup.maxSuggestions = 10; | ||
lookup.cityFilter = ["Ogden"]; | ||
lookup.stateFilter = ["IL"]; | ||
lookup.prefer = ["Ogden, IL"]; | ||
lookup.preferRatio = 0.33333333; | ||
client.send(lookup) | ||
.then(logSuggestions) | ||
.catch(console.log); | ||
function logSuggestions(response) { | ||
console.log(response.result); | ||
console.log("*********************"); | ||
} |
@@ -10,3 +10,10 @@ const SmartyStreetsSDK = require("../index"); | ||
let client = clientBuilder.buildUsExtractClient(); | ||
// Documentation for input fields can be found at: | ||
// https://smartystreets.com/docs/cloud/us-extract-api#http-request-input-fields | ||
let lookup = new Lookup("If you work at 1600 Pennsylvania Ave NW, Washington DC you're gonna have a hard time."); | ||
lookup.aggressive = true; | ||
lookup.addressesHaveLineBreaks = false; | ||
lookup.addressesPerLine = 1; | ||
@@ -13,0 +20,0 @@ client.send(lookup) |
@@ -11,5 +11,16 @@ const SmartyStreetsSDK = require("../index"); | ||
// Documentation for input fields can be found at: | ||
// https://smartystreets.com/docs/us-street-api#input-fields | ||
let lookup1 = new Lookup(); | ||
lookup1.inputId = "24601"; // Optional ID from your system | ||
lookup1.addressee = "John Doe"; | ||
lookup1.street = "330 N 100 W"; | ||
lookup1.street2 = "closet under the stairs"; | ||
lookup1.secondary = "APT 2"; | ||
lookup1.urbanization = ""; // Only applies to Puerto Rico addresses | ||
lookup1.city = "Provo"; | ||
lookup1.state = "Utah"; | ||
lookup1.zipCode = "84601"; | ||
lookup1.maxCandidates = 3; | ||
lookup1.match = "invalid"; | ||
@@ -19,8 +30,14 @@ | ||
lookup2.street = "1600 Amphitheater Pkwy"; | ||
lookup2.city = "Mountainview"; | ||
lookup2.state = "CA"; | ||
lookup2.lastLine = "Mountainview, CA"; | ||
lookup2.maxCandidates = 5; | ||
let lookup3 = new Lookup(); | ||
lookup3.inputId = "8675309"; | ||
lookup3.street = "1600 Amphitheatre Parkway Mountain View, CA 94043"; | ||
lookup3.maxCandidates = 1; | ||
let batch = new SmartyStreetsCore.Batch(); | ||
batch.add(lookup1); | ||
batch.add(lookup2); | ||
batch.add(lookup3); | ||
@@ -27,0 +44,0 @@ client.send(batch) |
@@ -11,8 +11,18 @@ const SmartyStreetsSDK = require("../index"); | ||
// Documentation for input fields can be found at: | ||
// https://smartystreets.com/docs/us-zipcode-api#input-fields | ||
let lookup1 = new Lookup(); | ||
lookup1.inputId = "01189998819991197253"; // Optional ID from your system | ||
lookup1.zipCode = "49786"; | ||
let lookup2 = new Lookup(); | ||
lookup2.inputId = "dfc33cb6-829e-4fea-aa1b-b6d6580f0817"; | ||
lookup2.city = "Provo"; | ||
lookup2.state = "UT"; | ||
lookup2.zipCode = "84604"; | ||
lookup1.zipCode = "49786"; | ||
lookup2.city = "Phoenix"; | ||
lookup2.state = "AZ"; | ||
let lookup3 = new Lookup(); | ||
lookup3.city = "Phoenix"; | ||
lookup3.state = "AZ"; | ||
@@ -22,2 +32,3 @@ let batch = new SmartyStreetsCore.Batch(); | ||
batch.add(lookup2); | ||
batch.add(lookup3); | ||
@@ -24,0 +35,0 @@ client.send(batch) |
@@ -11,15 +11,20 @@ module.exports = { | ||
Lookup: require("./src/us_street/Lookup"), | ||
Candidate: require("./src/us_street/Candidate") | ||
}, | ||
usZipcode: { | ||
Lookup: require("./src/us_zipcode/Lookup"), | ||
Result: require("./src/us_zipcode/Result") | ||
}, | ||
usAutocomplete: { | ||
Lookup: require("./src/us_autocomplete/Lookup"), | ||
Suggestion: require("./src/us_autocomplete/Suggestion") | ||
}, | ||
usExtract: { | ||
Lookup: require("./src/us_extract/Lookup"), | ||
Result: require("./src/us_extract/Result") | ||
}, | ||
internationalStreet: { | ||
Lookup: require("./src/international_street/Lookup"), | ||
Candidate: require("./src/international_street/Candidate") | ||
}, | ||
}; |
{ | ||
"name": "smartystreets-javascript-sdk", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Quick and easy SmartyStreets address validation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,2 +7,3 @@ class Request { | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Accept-Encoding": "gzip", | ||
}; | ||
@@ -9,0 +10,0 @@ |
@@ -67,2 +67,3 @@ const chai = require("chai"); | ||
expect(requestConfig.headers["Content-Type"]).to.equal("application/json; charset=utf-8"); | ||
expect(requestConfig.headers["Accept-Encoding"]).to.equal("gzip"); | ||
}); | ||
@@ -69,0 +70,0 @@ |
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
134269
2964