fyyd_ex v0.1.1 Fyyd.Utils View Source

Stuff that hasn’t found it’s place yet.

Link to this section Summary

Functions

Takes a Map, where the keys are Strings, and a List of expected fields. Returns Keyword List, where the keys are atoms

Takes a Keyword List, where the keys are atoms, and a Module name and returns a struct built from them

Link to this section Functions

Link to this function extract_from_response(data, expected_fields \\ []) View Source
extract_from_response(map(), [String.t()]) :: [{:key, :atom}]

Takes a Map, where the keys are Strings, and a List of expected fields. Returns Keyword List, where the keys are atoms.

Example

iex> Fyyd.Utils.extract_from_response(%{"foo" => "bar"}, ["foo"])
[foo: "bar"]
Link to this function struct_from_keyword_list(list, module) View Source
struct_from_keyword_list([{:key, atom()}], module()) :: struct()

Takes a Keyword List, where the keys are atoms, and a Module name and returns a struct built from them.