Brasilapi.Ddd.Info (BrasilAPI v0.1.5)

View Source

Struct representing DDD information from BrasilAPI DDD v1.

This struct contains DDD information including the state and list of cities that use the specified area code.

Summary

Functions

Creates a DDD Info struct from a map.

Types

t()

@type t() :: %Brasilapi.Ddd.Info{cities: [String.t()], state: String.t()}

Functions

from_map(map)

@spec from_map(map()) :: t()

Creates a DDD Info struct from a map.

Examples

iex> map = %{
...>   "state" => "SP",
...>   "cities" => [
...>     "EMBU",
...>     "VÁRZEA PAULISTA",
...>     "VARGEM GRANDE PAULISTA",
...>     "SÃO PAULO"
...>   ]
...> }
iex> Brasilapi.Ddd.Info.from_map(map)
%Brasilapi.Ddd.Info{
  state: "SP",
  cities: ["EMBU", "VÁRZEA PAULISTA", "VARGEM GRANDE PAULISTA", "SÃO PAULO"]
}