use of com.smartystreets.api.us_street.ClientBuilder in project API by ca-cwds.
the class SmartyStreet method getSmartyStreetsCandidates.
/**
* @param street incoming street address
* @param city incoming city name
* @param state incoming state
* @param zipCode incoming zip code
* @return returns a address back
*/
public List<Candidate> getSmartyStreetsCandidates(String street, String city, String state, Integer zipCode) {
Client client = new ClientBuilder(smartyStreetsDao.getClientId(), smartyStreetsDao.getToken()).build();
Lookup lookup = createSmartyStreetsLookup(street, city, state, zipCode);
try {
client.send(lookup);
} catch (SmartyException e) {
LOGGER.error("SmartyStreet error, Unable to validate the address", e);
throw new ApiException("ERROR calling SmartyStreet - ", e);
} catch (IOException e) {
LOGGER.error("SmartyStreet IO error, Unable to validate the address", e);
throw new ApiException("ERROR calling SmartyStreet - ", e);
}
return lookup.getResult();
}
Aggregations