Skip to content

Commit

Permalink
Add a @deprecated flag letting people know this is a temporary thing.…
Browse files Browse the repository at this point in the history
… Also a small fix for null pointers for headers.
  • Loading branch information
RyanLCox1 committed Jun 19, 2024
1 parent ca258cd commit ddaf73f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/smartystreets/api/SmartySender.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.IOException;
import java.net.Proxy;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.logging.Handler;
import java.util.logging.Level;
Expand Down Expand Up @@ -61,7 +62,7 @@ private okhttp3.Request buildHttpRequest(Request smartyRequest) throws IOExcepti
Map<String, Object> headers = smartyRequest.getHeaders();
Headers.Builder headersBuilder = new Headers.Builder();
for (String headerName : headers.keySet()) {
headersBuilder.add(headerName, headers.get(headerName).toString());
headersBuilder.add(headerName, Optional.ofNullable(headers.get(headerName)).orElse("").toString());
}

okhttp3.Request.Builder requestBuilder = new okhttp3.Request.Builder()
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/com/smartystreets/api/us_street/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ public String getMatch() {
return null;
}

/**
* This is a temporary flag meant to fix an intermittent data issue
* Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
*
* @deprecated - Temporary - will be removed in a future release.
*/
@JsonProperty("compatibility")
public String getCompatibility() {
//This is a temporary flag meant to fix an intermittent data issue
//Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
return this.compatibility;
}

Expand Down Expand Up @@ -214,9 +218,13 @@ public void setUrbanization(String urbanization) {
this.urbanization = urbanization;
}

/**
* This is a temporary flag meant to fix an intermittent data issue
* Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
*
* @deprecated - Temporary - will be removed in a future release.
*/
public void setCompatibility(String compatibility) {
//This is a temporary flag meant to fix an intermittent data issue
//Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
this.compatibility = compatibility;
}
/**
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/smartystreets/api/us_zipcode/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ private void populateQueryString(Lookup lookup, Request request) {
request.putParameter("city", lookup.getCity());
request.putParameter("state", lookup.getState());
request.putParameter("zipcode", lookup.getZipCode());
//This is a temporary flag meant to fix an intermittent data issue
//Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
request.putParameter("compatibility", lookup.getCompatibility());
}


Expand Down
25 changes: 25 additions & 0 deletions src/main/java/com/smartystreets/api/us_zipcode/Lookup.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public class Lookup implements Serializable {
private String state;
private String zipcode;

//This is a temporary flag meant to fix an intermittent data issue
//Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
private String compatibility;


//endregion

public Lookup() {
Expand Down Expand Up @@ -67,6 +72,16 @@ public String getInputId() {
return this.inputId;
}

/**
* This is a temporary flag meant to fix an intermittent data issue
* Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
*
* @deprecated - Temporary - will be removed in a future release.
*/
public String getCompatibility() {
return this.compatibility;
}

//endregion

//region [ Setters ]
Expand All @@ -91,6 +106,16 @@ public void setZipCode(String zipcode) {
this.zipcode = zipcode;
}

/**
* This is a temporary flag meant to fix an intermittent data issue
* Unless explicitly instructed by the Smarty Tech Support team, DO NOT use this parameter
*
* * @deprecated - Temporary - will be removed in a future release.
*/
public void setCompatibility(String compatibility) {
this.compatibility = compatibility;
}

public Lookup setInputId(String inputId) {
this.inputId = inputId;
return this;
Expand Down

0 comments on commit ddaf73f

Please sign in to comment.