View Source YubinBango (YubinBango v0.1.7)
YubinBango is a library for lookup address with Japan postal code.
Summary
Functions
Returns a specification to start this module under a supervisor.
Lookup the zipcode and return the result.
Start the yubin bango server.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec lookup(String.t()) :: {:ok, map()} | {:error, :wrong_format, String.t()} | {:error, :not_found}
Lookup the zipcode and return the result.
Examples
iex> YubinBango.lookup("105-0004")
{:ok, %YubinBango.Address{city: "港区", city_kana: "ミナトク", district: "新橋", district_kana: "シンバシ", prefecture: "東京都", prefecture_kana: "トウキョウト", zipcode: "1050004"}}
iex> YubinBango.lookup("1050004")
{:ok, %YubinBango.Address{city: "港区", city_kana: "ミナトク", district: "新橋", district_kana: "シンバシ", prefecture: "東京都", prefecture_kana: "トウキョウト", zipcode: "1050004"}}
iex> YubinBango.lookup("1234567")
{:error, :not_found}
iex> YubinBango.lookup("12345678")
{:error, :wrong_format, "Please specify a 7-digit zip code with or without hyphen. (e.g. 1234567 or 123-4567)"}
@spec start_link([]) :: {:ok, pid()}
Start the yubin bango server.