diff options
author | Lindolfo 'Lorn' Rodrigues <lorn@lornlab.org> | 2019-02-13 16:40:19 -0200 |
---|---|---|
committer | Lindolfo 'Lorn' Rodrigues <lorn@lornlab.org> | 2019-02-13 16:59:20 -0200 |
commit | ab206a90b61f7b411dae49e0676cd64165ee10f2 (patch) | |
tree | 467b6b9d2624bf1acd3ed9a9215baf295088df9a /lib/powerdnsex/models/zone.ex | |
parent | bump version (diff) |
Support Elixir-1.8
Also dropped support for elixir < 1.6
Diffstat (limited to '')
-rw-r--r-- | lib/powerdnsex/models/zone.ex | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/powerdnsex/models/zone.ex b/lib/powerdnsex/models/zone.ex index 8620443..96089e0 100644 --- a/lib/powerdnsex/models/zone.ex +++ b/lib/powerdnsex/models/zone.ex @@ -6,15 +6,26 @@ defmodule PowerDNSex.Models.Zone do @body_attrs ~w(account dns kind masters name nameservers records serial soa_edit soa_edit_api)a - defstruct name: nil, kind: "Native", masters: [], nameservers: [], rrsets: [], - account: nil, comments: [], dnssec: false, id: nil, last_check: 0, - notified_serial: 0, serial: nil, soa_edit: "", soa_edit_api: "", + defstruct name: nil, + kind: "Native", + masters: [], + nameservers: [], + rrsets: [], + account: nil, + comments: [], + dnssec: false, + id: nil, + last_check: 0, + notified_serial: 0, + serial: nil, + soa_edit: "", + soa_edit_api: "", url: nil @type t :: %__MODULE__{} def as_body(%__MODULE__{} = zone) do - get_valid_attrs = fn({attr, value}, body) -> + get_valid_attrs = fn {attr, value}, body -> if Enum.member?(@body_attrs, attr) do Map.merge(body, %{attr => value}) else @@ -23,8 +34,8 @@ defmodule PowerDNSex.Models.Zone do end zone - |> Map.from_struct + |> Map.from_struct() |> Enum.reduce(%{}, get_valid_attrs) - |> Poison.encode! + |> Poison.encode!() end end |