Scala library for interaction with SmartyStreets REST API.
Add following to your build.sbt
resolvers in Global += Resolver.url("upstartcommerce", url("https://upstartcommerce.bintray.com/generic"))(Resolver.ivyStylePatterns)
libraryDependencies += "org.upstartcommerce" %% "smartystreets-scala-sdk" % "0.0.2" // or whatever latest version is
Basic usage is:
import org.upstartcommerce.smartystreets.SmartyStreetsIntegration
import org.upstartcommerce.smartystreets.common._
class MyAddressVerificationService extends SmartyStreetsIntegration {
override val smartyStreetsConfig = SmartyStreetsConfig(
authId = "myAuthId",
authToken = "myAuthToken"
)
}
object Main {
def main(args: Array[String]): Unit = {
val service = new MyAddressVerificationService
val address = USAddressRequest(
street = Some("60 Wall St"),
city = Some("New York"),
state = Some("NY"),
zipcode = Some("10005")
)
service.verifyAddress(address).map { resp =>
println(resp) // Process response
}
}
}
Note: Implicit
ActorSystem
,ActorMaterializer
andExecutionContext
are required
See tests for more examples.