Zoonk.Locations (Zoonk v0.1.0-dev)

View Source

Handles geographic and regional data.

This data can be used for compliance, billing, and legal purposes. But it can also be extended to include more complex geographic operations in the future.

Summary

Functions

Retrieves a country by its ISO2 code.

Retrieves the symbol for a currency by its code.

Lists all supported countries.

Functions

get_country(iso2_code)

Retrieves a country by its ISO2 code.

Returns a Zoonk.Locations.Country struct if found, or nil if not found.

Examples

iex> get_country("US")
%Zoonk.Locations.Country{
  iso2: "US",
  iso3: "USA",
  name: "United States of America",
  currency: %Zoonk.Locations.Currency{code: "USD", name: "US Dollar"}
}

iex> get_country("XX")
nil

get_currency_symbol(currency_code)

Retrieves the symbol for a currency by its code.

Returns the currency symbol if found, or nil if not found.

Examples

iex> get_currency_symbol("USD")
"$"

iex> get_currency_symbol("BRL")
"R$"

iex> get_currency_symbol("EUR")
"€"

iex> get_currency_symbol("XXX")
nil

list_countries()

Lists all supported countries.

Returns a list of Zoonk.Locations.Country structs containing ISO codes, names, and currency information.