Correios CEP v0.1.0 Correios.CEP View Source
Find Brazilian addresses by zipcode, directly from Correios database. No HTML parsers.
Link to this section Summary
Link to this section Functions
Find address by a given zip code.
Examples
iex> Correios.CEP.find_address!("54250610")
%Correios.CEP.Address{
city: "Jaboatão dos Guararapes",
complement: "",
neighborhood: "Cavaleiro",
state: "PE",
street: "Rua Fernando Amorim",
zipcode: "54250610"
}
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"
}
When zip code is not found.
iex> Correios.CEP.find_address("00000000")
** (Correios.CEP.Error) CEP NAO ENCONTRADO
Find address by a given zip code.
Examples
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("54250-610")
{:ok,
%Correios.CEP.Address{
city: "Jaboatão dos Guararapes",
complement: "",
neighborhood: "Cavaleiro",
state: "PE",
street: "Rua Fernando Amorim",
zipcode: "54250610"
}}
When zip code is not found.
iex> Correios.CEP.find_address("00000000")
{:error, %Correios.CEP.Error{reason: "CEP NAO ENCONTRADO"}}