smartystreets-javascript-sdk 1.11.3-beta.0 → 1.11.6

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.
package/Makefile CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/make -f
2
2
 
3
- VERSION := $(shell tagit -p --dry-run)
3
+ VERSION := 1.11.6
4
4
  VERSION_FILE1 := package.json
5
5
  VERSION_FILE2 := package-lock.json
6
6
 
@@ -14,7 +14,7 @@ node_modules:
14
14
  npm install
15
15
 
16
16
  publish: clean test version upload unversion
17
- tagit -p
17
+ git tag 1.11.6
18
18
  git push origin --tags
19
19
 
20
20
  upload:
@@ -0,0 +1,43 @@
1
+ const SmartyStreetsSDK = require("smartystreets-javascript-sdk");
2
+ const SmartyStreetsCore = SmartyStreetsSDK.core;
3
+ const Lookup = SmartyStreetsSDK.internationalAddressAutocomplete.Lookup;
4
+
5
+ // US Autocomplete Pro only supports using Website Keys
6
+ let key = process.env.SMARTY_WEBSITE_KEY;
7
+ const credentials = new SmartyStreetsCore.SharedCredentials(key);
8
+
9
+ // The appropriate license values to be used for your subscriptions
10
+ // can be found on the Subscription page of the account dashboard.
11
+ // https://www.smartystreets.com/docs/cloud/licensing
12
+ let clientBuilder = new SmartyStreetsCore.ClientBuilder(credentials).withLicenses(["international-autocomplete-cloud"])
13
+ // .withBaseUrl("");
14
+ let client = clientBuilder.buildInternationalAddressAutocompleteClient();
15
+
16
+ // Documentation for input fields can be found at:
17
+ //www.smartystreets.com/docs/cloud/international-address-autocomplete-api#pro-http-request-input-fields
18
+
19
+ let lookup = new Lookup("Ave", "CAN");
20
+
21
+ client.send(lookup)
22
+ .then(function (results) {
23
+ logSuggestions(results, "Simple Lookup");
24
+ })
25
+ .catch(console.log);
26
+
27
+ // *** Using Filter and Prefer ***
28
+ lookup = new Lookup("Ave", "CAN");
29
+
30
+ lookup.maxResults = 10;
31
+ // lookup.include_only_administrative_area = "";
32
+ lookup.include_only_locality = "Sherwood Park";
33
+ // lookup.include_only_postal_code = "";
34
+
35
+ client.send(lookup)
36
+ .then(function(results) { logSuggestions(results, "Using Filter and Prefer")})
37
+ .catch(console.log);
38
+
39
+ function logSuggestions(response, message) {
40
+ console.log(message);
41
+ console.log(response.result);
42
+ console.log("*********************");
43
+ }
@@ -16,7 +16,6 @@ let client = clientBuilder.buildUsAutocompleteProClient();
16
16
  // Documentation for input fields can be found at:
17
17
  // https://smartystreets.com/docs/cloud/us-autocomplete-api#pro-http-request-input-fields
18
18
 
19
-
20
19
  // *** Simple Lookup ***
21
20
  let lookup = new Lookup("4770 Lincoln");
22
21
 
@@ -24,7 +23,6 @@ client.send(lookup)
24
23
  .then(function(results) { logSuggestions(results, "Simple Lookup") })
25
24
  .catch(console.log);
26
25
 
27
-
28
26
  // *** Using Filter and Prefer ***
29
27
  lookup = new Lookup("4770 Lincoln");
30
28
 
@@ -38,7 +36,6 @@ client.send(lookup)
38
36
  .then(function(results) { logSuggestions(results, "Using Filter and Prefer") })
39
37
  .catch(console.log);
40
38
 
41
-
42
39
  // *** Using 'selected' to Expand Secondaries ***
43
40
  lookup = new Lookup("4770 Lincoln");
44
41
 
@@ -48,7 +45,6 @@ client.send(lookup)
48
45
  .then(function(results) { logSuggestions(results, "Using 'selected' to Expand Secondaries") })
49
46
  .catch(console.log);
50
47
 
51
-
52
48
  // ************************************************
53
49
 
54
50
  function logSuggestions(response, message) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smartystreets-javascript-sdk",
3
- "version": "1.11.3-beta.0",
3
+ "version": "1.11.6",
4
4
  "description": "Quick and easy SmartyStreets address validation.",
5
5
  "keywords": [
6
6
  "smartystreets",
@@ -15,6 +15,9 @@ class Client {
15
15
  request.parameters = {
16
16
  search: lookup.search,
17
17
  country: lookup.country,
18
+ include_only_administrative_area: lookup.include_only_administrative_area,
19
+ include_only_locality: lookup.include_only_locality,
20
+ include_only_postal_code: lookup.include_only_postal_code,
18
21
  };
19
22
 
20
23
  return new Promise((resolve, reject) => {
@@ -17,6 +17,9 @@ describe("An International Address Autocomplete Client", function () {
17
17
  let lookup = new Lookup(search);
18
18
  let expectedParameters = {
19
19
  search: search,
20
+ include_only_administrative_area: "",
21
+ include_only_locality: "",
22
+ include_only_postal_code: "",
20
23
  country: "United States",
21
24
  };
22
25
 
@@ -32,8 +35,11 @@ describe("An International Address Autocomplete Client", function () {
32
35
  lookup.search = search;
33
36
  lookup.country = "Russia";
34
37
  let expectedParameters = {
35
- search: search,
36
38
  country: "Russia",
39
+ include_only_administrative_area: "",
40
+ include_only_locality: "",
41
+ include_only_postal_code: "",
42
+ search: search,
37
43
  };
38
44
 
39
45
  client.send(lookup);