Cepex.Service behaviour (cepex v0.1.0) View Source

The Cepex.Service defines the behaviour for postal code lookup APIs.

Link to this section Summary

Callbacks

Lookups a postal code (CEP) and returns a Cepex.Address struct with the address information.

Link to this section Callbacks

Link to this callback

lookup(http_client, cep)

View Source

Specs

lookup(http_client :: module(), cep :: Cepex.CEP.t()) ::
  {:ok, Cepex.Address.t()}
  | {:error, :cep_not_found}
  | {:error, :request_failed}
  | {:error, {:invalid_response, Cepex.HTTP.Response.t()}}

Lookups a postal code (CEP) and returns a Cepex.Address struct with the address information.