Current section

Files

Jump to
off_broadway_splunk lib off_broadway splunk job.ex
Raw

lib/off_broadway/splunk/job.ex

defmodule OffBroadway.Splunk.Job do
@moduledoc false
defstruct [
:name,
:published,
:is_done,
:is_zombie,
:is_scheduled
]
@type t :: %__MODULE__{
name: String.t(),
published: String.t(),
is_done: boolean(),
is_zombie: boolean(),
is_scheduled: boolean()
}
use ExConstructor
def new(map_or_kwlist, opts \\ []) do
case super(map_or_kwlist, opts) do
%{published: published} = struct when is_binary(published) ->
{:ok, datetime, _offset} = DateTime.from_iso8601(published)
%{struct | published: datetime}
struct ->
struct
end
end
end