rogersouza / correios-cep-elixir

Find Brazilian addresses by zip code, directly from Correios database. No HTML parsers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Correios CEP

Hex.pm Docs Build Status Coverage Status License

Correios Logo

Find Brazilian addresses by zip code, directly from Correios database. No HTML parsers.

Installation

The package can be installed by adding correios_cep to your list of dependencies in mix.exs:

def deps do
  [{:correios_cep, "~> 0.3"}]
end

Usage

iex> Correios.CEP.find_address("54250610")
{:ok,
 %Correios.CEP.Address{
   city: "Jaboatão dos Guararapes",
   complement: "",
   neighborhood: "Cavaleiro",
   state: "PE",
   street: "Rua Fernando Amorim",
   zipcode: "54250610"
 }}

iex> Correios.CEP.find_address("00000-000")
{:error, %Correios.CEP.Error{reason: "CEP NAO ENCONTRADO"}}

iex> Correios.CEP.find_address!("54250-610")
%Correios.CEP.Address{
  city: "Jaboatão dos Guararapes",
  complement: "",
  neighborhood: "Cavaleiro",
  state: "PE",
  street: "Rua Fernando Amorim",
  zipcode: "54250610"
}

iex> Correios.CEP.find_address!("00000-000")
** (Correios.CEP.Error) CEP NAO ENCONTRADO

Options

Options for timeout are supported. Refer to Correios.CEP.find_address/2 to see all available options.

The full documentation is available at https://hexdocs.pm/correios_cep.

Contributing

See the contributing guide.

License

Correios CEP is released under the Apache 2.0 License. See the LICENSE file.

Author

Fernando Hamasaki de Amorim (prodis)

Prodis Logo

About

Find Brazilian addresses by zip code, directly from Correios database. No HTML parsers.

License:Apache License 2.0


Languages

Language:Elixir 100.0%