Current section
Files
Jump to
Current section
Files
lib/webuntis/struct/absence.ex
defmodule Webuntis.Struct.Absence do
defstruct [
:absence_reason,
:absence_reason_id,
:end_date_time,
:excuse,
:excused,
:id,
:klasse_id,
:owner,
:start_date_time,
:student_id,
:text
]
@doc since: "2.0.0"
def from_map(jason_map) do
%Webuntis.Struct.Absence{
absence_reason: Map.fetch!(jason_map, "absenceReason"),
absence_reason_id: Map.fetch!(jason_map, "absenceReasonId"),
end_date_time: Map.fetch!(jason_map, "endDateTime"),
excuse: Map.fetch!(jason_map, "excuse") |> Webuntis.Struct.Excuse.from_map(),
excused: Map.fetch!(jason_map, "excused"),
id: Map.fetch!(jason_map, "id"),
klasse_id: Map.fetch!(jason_map, "absenceReason"),
owner: Map.fetch!(jason_map, "owner"),
start_date_time: Map.fetch!(jason_map, "absenceReason"),
text: Map.fetch!(jason_map, "text")
}
end
end