Small decoding helpers shared by every resource module.
These centralize the two recurring conversions needed when mapping Ramp's
JSON payloads onto typed structs: parsing RFC 3339 timestamps into
DateTime and safely converting map fields into keyword lists suitable
for URI.encode_query/1.
Summary
Functions
Passes through non-nil values, drops nils -- used for building query keyword lists.
Parses an RFC 3339 timestamp string into a DateTime, passing nil through.
Encodes an enum-like atom/string value to the wire string Ramp expects.
Formats a DateTime (or ISO date/naive/date) as an RFC 3339 string for query params.
Functions
Passes through non-nil values, drops nils -- used for building query keyword lists.
@spec datetime(String.t() | nil) :: DateTime.t() | nil
Parses an RFC 3339 timestamp string into a DateTime, passing nil through.
Encodes an enum-like atom/string value to the wire string Ramp expects.
@spec to_iso8601(DateTime.t() | NaiveDateTime.t() | Date.t() | nil) :: String.t() | nil
Formats a DateTime (or ISO date/naive/date) as an RFC 3339 string for query params.