Packages

A simple Elixir client for BrasilAPI, a public API that provides access to various Brazilian data such as postal codes, banks, states, cities, and more.

Current section

Files

Jump to
brasilapi lib brasilapi fipe reference_table.ex
Raw

lib/brasilapi/fipe/reference_table.ex

defmodule Brasilapi.Fipe.ReferenceTable do
@moduledoc """
Struct representing a FIPE reference table.
"""
@type t :: %__MODULE__{
codigo: integer(),
mes: String.t()
}
defstruct [:codigo, :mes]
@doc """
Creates a ReferenceTable struct from a map.
Supports both string and atom keys.
"""
@spec from_map(map()) :: t()
def from_map(%{} = map) do
%__MODULE__{
codigo: Map.get(map, "codigo"),
mes: Map.get(map, "mes")
}
end
end