Breezex.Util (breezex v0.1.0) View Source

Module responsible for transforming arguments for requests.

Link to this section Summary

Functions

Unwraps request responses, raising if there's an error

Transforms a map of request params to a URL encoded query string.

Returns a string of format "DD-MM-YYYY" for a date

Returns a string of format "YYYY-MM-DD" for a date

Link to this section Functions

Specs

bang_output({:ok, any(), any()}) :: {any(), any()}

Unwraps request responses, raising if there's an error

Link to this function

build_query_string(params)

View Source

Specs

build_query_string(map()) :: String.t()

Transforms a map of request params to a URL encoded query string.

Example

iex> Breezex.Util.build_query_string(%{count: 1, person_id: 5})
"?count=1&person_id=5"

Specs

date_to_DDMMYYYY(Date | DateTime) :: String.t()

Returns a string of format "DD-MM-YYYY" for a date

Example

iex> Breezex.Util.date_to_DDMMYYYY(%Date{day: 3, month: 5, year: 2018})
"03-05-2018"

Specs

date_to_YYYYMMDD(Date | DateTime) :: String.t()

Returns a string of format "YYYY-MM-DD" for a date

Example

iex> Breezex.Util.date_to_DDMMYYYY(%Date{day: 3, month: 5, year: 2018})
"2018-05-03"