Scala SDK for SmartyStreets (https://smartystreets.com)
libraryDependencies += "com.outr" %% "smartystreets-scala-sdk" % "1.0.6"
Create an instance of SmartyStreets:
val ss = new SmartyStreets(authId = "", authToken = "")Note: it is usually not ideal to inline details like this into your code as it can change and for security reasons.
This project relies on Profig to allow configuration to be defined as:
- Command-line arguments (
-smartystreets.authId=abc123 -smartystreets.authToken=abc123and loaded withProfig.merge(args)) - Configuration JSON (stored in
config.jsonand loaded withProfig.loadDefaults()):{ "smartystreets": { "authId": "abc123", "authToken": "abc123" } } - Environment Variables (
SMARTY_STREETS_AUTH_ID=abc123andSMARTY_STREETS_AUTH_TOKEN=abc123)
If any of those external configuration options are available simply instantiate SmartyStreets with default arguments:
val ss = new SmartyStreets()Single address lookup is as simple as:
val validated: Future[List[StreetAddress]] = ss.streets.us(street = Some("345 Spear Street San Francisco, CA"))Single ZIP lookup is as simple as:
val validated: Future[List[Zip]] = ss.zip.us(zipcode = Some("84101"))Currently, no support has been added for international validations or autocompletion.