Skip to content

Commit 2dae822

Browse files
authored
Remove US Autocomplete and allow users to send requests to the US Autocomplete Pro API with geolocation turned off. (#61)
* Got rid of STATE and changed the NONE name to be "none" in the GeolocateTypes * removed the us_autocomplete files and tests * Fixed comments to reference the US Autocomplete Pro API rather than the US Autocomplete API. * Changed the if statement to allow the geolocateType to be "none" in the request.
1 parent c585d49 commit 2dae822

15 files changed

Lines changed: 12 additions & 454 deletions

File tree

src/main/java/com/smartystreets/api/ClientBuilder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
public class ClientBuilder {
1717
private final static String INTERNATIONAL_STREET_API_URL = "https://international-street.api.smarty.com/verify";
1818
private final static String INTERNATIONAL_AUTOCOMPLETE_API_URL = "https://international-autocomplete.api.smarty.com/v2/lookup";
19-
private final static String US_AUTOCOMPLETE_API_URL = "https://us-autocomplete.api.smarty.com/suggest";
2019
private final static String US_AUTOCOMPLETE_API_PRO_URL = "https://us-autocomplete-pro.api.smarty.com/lookup";
2120
private final static String US_EXTRACT_API_URL = "https://us-extract.api.smarty.com/";
2221
private final static String US_STREET_API_URL = "https://us-street.api.smarty.com/street-address";
@@ -164,11 +163,6 @@ public com.smartystreets.api.international_autocomplete.Client buildInternationa
164163
return new com.smartystreets.api.international_autocomplete.Client(this.buildSender(), this.serializer);
165164
}
166165

167-
public com.smartystreets.api.us_autocomplete.Client buildUsAutocompleteApiClient() {
168-
this.ensureURLPrefixNotNull(US_AUTOCOMPLETE_API_URL);
169-
return new com.smartystreets.api.us_autocomplete.Client(this.buildSender(), this.serializer);
170-
}
171-
172166
public com.smartystreets.api.us_autocomplete_pro.Client buildUsAutocompleteProApiClient() {
173167
this.ensureURLPrefixNotNull(US_AUTOCOMPLETE_API_PRO_URL);
174168
return new com.smartystreets.api.us_autocomplete_pro.Client(this.buildSender(), this.serializer);

src/main/java/com/smartystreets/api/GeolocateType.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package com.smartystreets.api;
22

33
/**
4-
* This field corresponds to the <b>geolocate</b> and <b>geolocate_precision</b> fields in the US Autocomplete API.
4+
* This field corresponds to the <b>geolocate_precision</b> field in the US Autocomplete Pro API.
55
*
6-
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields"
6+
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-pro-api#http-request-input-fields"
77
*/
88
public enum GeolocateType {
9-
CITY("city"), STATE("state"), NONE("null");
9+
CITY("city"), NONE("none");
1010

1111
private final String name;
1212

src/main/java/com/smartystreets/api/international_autocomplete/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.Objects;
88

99
/**
10-
* This client sends lookups to the SmartyStreets US Autocomplete API, <br>
10+
* This client sends lookups to the SmartyStreets US Autocomplete Pro API, <br>
1111
* and attaches the results to the appropriate Lookup objects.
1212
*/
1313
public class Client {

src/main/java/com/smartystreets/api/us_autocomplete/Client.java

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/main/java/com/smartystreets/api/us_autocomplete/Lookup.java

Lines changed: 0 additions & 166 deletions
This file was deleted.

src/main/java/com/smartystreets/api/us_autocomplete/Result.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/main/java/com/smartystreets/api/us_autocomplete/Suggestion.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/main/java/com/smartystreets/api/us_autocomplete_pro/Client.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.List;
99

1010
/**
11-
* This client sends lookups to the SmartyStreets US Autocomplete API, <br>
11+
* This client sends lookups to the SmartyStreets US Autocomplete Pro API, <br>
1212
* and attaches the results to the appropriate Lookup objects.
1313
*/
1414
public class Client {
@@ -48,7 +48,7 @@ private Request buildRequest(Lookup lookup) {
4848
request.putParameter("prefer_states", this.buildString(lookup.getPreferState()));
4949
request.putParameter("prefer_zip_codes", this.buildString(lookup.getPreferZipcode()));
5050
request.putParameter("prefer_ratio", lookup.getPreferRatioStringIfSet());
51-
if (lookup.getGeolocateType() != GeolocateType.NONE) {
51+
if (lookup.getGeolocateType() != null) {
5252
request.putParameter("prefer_geolocation", lookup.getGeolocateType().getName());
5353
}
5454
request.putParameter("selected", lookup.getSelected());

src/main/java/com/smartystreets/api/us_autocomplete_pro/Lookup.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* In addition to holding all of the input data for this lookup, this class also<br>
1010
* will contain the result of the lookup after it comes back from the API.
11-
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-request-input-fields"
11+
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-pro-api#http-request-input-fields"
1212
*/
1313
public class Lookup {
1414
final int PREFER_RATIO_DEFAULT = 100;
@@ -166,7 +166,7 @@ public void setPreferCity(List<String> cities) {
166166
/***
167167
* Sets the percentage of suggestions that are to be from preferred cities/states.
168168
* @param preferRatio An integer value, range [0, 100]. Default is 33.
169-
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#preference"
169+
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-pro-api#preference"
170170
*/
171171
public void setPreferRatio(int preferRatio) {
172172
this.preferRatio = preferRatio;

src/main/java/com/smartystreets/api/us_autocomplete_pro/Suggestion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.io.Serializable;
66

77
/**
8-
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response"
8+
* @see "https://smartystreets.com/docs/cloud/us-autocomplete-pro-api#http-response"
99
*/
1010
public class Suggestion implements Serializable {
1111
//region [ Fields ]

0 commit comments

Comments
 (0)