ExEasyPost

Build StatusHexDocs

ExEasyPost is an Elixir client library for the EasyPost API.

Features

  1. Support for all EasyPost resources
  2. Minimal configuration. Choose your favorite HTTP client and JSON codec.
  3. Support for per-request configuration

Getting Started

ExEasyPost allows you to choose which HTTP client and JSON codec you would like to use. ExEasyPost supports :httpoison (HTTP client) and :poison (JSON codec) out of the box.

defp deps do
  [
    {:ex_easypost, "~> 1.0"},
    {:httpoison, "~> 0.13"},
    {:poison, "~> 3.1"}
  ]
end

Usage

ExEasyPost.Address.find("adr_a6fd5dd822c94bdfa1e3f2d28a4dbf9c")
|> ExEasyPost.request()

ExEasyPost will return {:ok, response} on success and {:error, reason} on failure.

Configuration

ExEasyPost allows you to provide configuration as part of your application config or on a per-request basis.

Application configuration

config :ex_easypost,
  api_key: "xxx"

Per-request configuration

config = %{api_key: "xxx"}

ExEasyPost.Address.find("adr_a6fd5dd822c94bdfa1e3f2d28a4dbf9c")
|> ExEasyPost.request(config)

Configuration options

Supported Resources