Carrier

Elixir CI

This is an unofficial Elixir client for the excellent Smarty address verification service.

It's fairly bare-bones because all we need it for is verifying and standardizing addresses, however it might get beefed up in the future. There's a ton of data provided by Smarty in addition to the verification process, and some of it might be pretty useful to have (such as geo-coding, timezone data, etc.).

It is essentially just a GenServer that handles the minutiae of communicating with the Smarty API.

Installation

Add carrier to your list of dependencies in mix.exs:

def deps do
  [{:carrier, "~> 2.0"}]
end

Configuration

Carrier supports environment-specific configuration for working with the Smarty API. You can configure it in different ways depending on your environment:

Production

In production, use environment variables for sensitive data:

# config/prod.exs
config :carrier, Carrier,
  auth_id: System.get_env("SMARTY_AUTH_ID"),
  auth_token: System.get_env("SMARTY_AUTH_TOKEN")

Development

For local development, you can either:

  1. Set environment variables:

    export SMARTY_AUTH_ID=your_auth_id_here
    export SMARTY_AUTH_TOKEN=your_auth_token_here
  2. Or create a .env file based on the provided .env.example and use a library like Dotenv to load it.

Testing and CI

For testing and CI environments, you can:

  1. Set environment variables in your CI platform
  2. Use the default test values provided in config/test.exs
# config/test.exs
config :carrier, Carrier,
  auth_id: System.get_env("SMARTY_AUTH_ID") || "test_auth_id",
  auth_token: System.get_env("SMARTY_AUTH_TOKEN") || "test_auth_token"

Continuous Integration

Carrier uses GitHub Actions for continuous integration. The CI pipeline automatically:

You can see the CI configuration in .github/workflows/ci.yml.

Usage

TBD