logic_monitor v0.0.8 LogicMonitor.QueryParams

Helper module to convert parameters passed as a keyword list into a querystring.

Summary

Functions

Converts a keyword list and a list of atoms into a querystring containing only entries that exist in both the keyword list and the list of atoms

Functions

convert(params, list)

Specs

convert([{atom, String.t}], [atom]) :: String.t

Converts a keyword list and a list of atoms into a querystring containing only entries that exist in both the keyword list and the list of atoms.

Examples

iex> LogicMonitor.QueryParams.convert([asdf: 123, hjkl: 456], [:asdf, :hjkl])
"asdf=123&hjkl=456"

iex> LogicMonitor.QueryParams.convert([asdf: 123, hjkl: 456], [:asdf])
"asdf=123"

iex> LogicMonitor.QueryParams.convert([asdf: 123, hjkl: 456], [:hjkl])
"hjkl=456"

iex> LogicMonitor.QueryParams.convert([asdf: 123, hjkl: 456], [:qwerty])
""

iex> LogicMonitor.QueryParams.convert([asdf: 123, hjkl: 456], [])
""