https://github.com/outr/smartystreets-scala-sdk
Scala SDK for SmartyStreets (https://smartystreets.com)
https://github.com/outr/smartystreets-scala-sdk
Last synced: 2 months ago
JSON representation
Scala SDK for SmartyStreets (https://smartystreets.com)
- Host: GitHub
- URL: https://github.com/outr/smartystreets-scala-sdk
- Owner: outr
- License: mit
- Created: 2018-04-13T17:50:22.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T19:13:08.000Z (about 7 years ago)
- Last Synced: 2025-03-17T11:19:53.400Z (over 1 year ago)
- Language: Scala
- Size: 29.3 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# smartystreets-scala-sdk
Scala SDK for SmartyStreets (https://smartystreets.com)
## SBT Configuration
```
libraryDependencies += "com.outr" %% "smartystreets-scala-sdk" % "1.0.6"
```
## Initialization
Create an instance of `SmartyStreets`:
```scala
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](https://github.com/outr/profig) to allow configuration to be defined as:
* Command-line arguments (`-smartystreets.authId=abc123 -smartystreets.authToken=abc123` and loaded with `Profig.merge(args)`)
* Configuration JSON (stored in `config.json` and loaded with `Profig.loadDefaults()`):
```json
{
"smartystreets": {
"authId": "abc123",
"authToken": "abc123"
}
}
```
* Environment Variables (`SMARTY_STREETS_AUTH_ID=abc123` and `SMARTY_STREETS_AUTH_TOKEN=abc123`)
If any of those external configuration options are available simply instantiate `SmartyStreets` with default arguments:
```scala
val ss = new SmartyStreets()
```
## US Address Lookup
Single address lookup is as simple as:
```scala
val validated: Future[List[StreetAddress]] = ss.streets.us(street = Some("345 Spear Street San Francisco, CA"))
```
## US Zip Lookup
Single ZIP lookup is as simple as:
```scala
val validated: Future[List[Zip]] = ss.zip.us(zipcode = Some("84101"))
```
## Limitations
Currently, no support has been added for international validations or autocompletion.