Correios CEP v0.7.0 Correios.CEP.Address View Source

Address structure.

Link to this section Summary

Functions

Creates a new Correios.CEP.Address struct with the given values.

Link to this section Types

Specs

t() :: %Correios.CEP.Address{
  city: String.t(),
  complement: String.t(),
  neighborhood: String.t(),
  postal_code: String.t(),
  state: String.t(),
  street: String.t()
}

Link to this section Functions

Specs

new(map()) :: t()

Creates a new Correios.CEP.Address struct with the given values.

The values will be converted to string, and complement and complement2 keys will be joined into the complement field.

Examples

iex> Correios.CEP.Address.new(%{
...>   street: 'Street',
...>   neighborhood: 'Neighborhood',
...>   complement: ' complement one',
...>   complement2: 'complement two ',
...>   city: 'City',
...>   state: 'ST',
...>   postal_code: '12345678'
...> })
%Correios.CEP.Address{
  city: "City",
  complement: "complement one complement two",
  neighborhood: "Neighborhood",
  state: "ST",
  street: "Street",
  postal_code: "12345678"
}