X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Ftwitter_api%2Frepresenters%2Fbase_representer.ex;h=f32a21d4724e2ae3e8c69db014415270e25c62eb;hb=4a922305afb9b445d11522be73428f10a7d1fc19;hp=f13a544129df7a6226261d5dd845fc10173e420c;hpb=00c032783d12d19529944d7f17123418e02ce1a5;p=akkoma diff --git a/lib/pleroma/web/twitter_api/representers/base_representer.ex b/lib/pleroma/web/twitter_api/representers/base_representer.ex index f13a54412..f32a21d47 100644 --- a/lib/pleroma/web/twitter_api/representers/base_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/base_representer.ex @@ -1,16 +1,18 @@ defmodule Pleroma.Web.TwitterAPI.Representers.BaseRepresenter do defmacro __using__(_opts) do quote do - alias Calendar.Strftime - def to_json(object) do to_json(object, %{}) end + def to_json(object) do + to_json(object, %{}) + end + def to_json(object, options) do object |> to_map(options) - |> Poison.encode! + |> Jason.encode!() end def enum_to_list(enum, options) do - mapping = fn (el) -> to_map(el, options) end + mapping = fn el -> to_map(el, options) end Enum.map(enum, mapping) end @@ -18,23 +20,14 @@ defmodule Pleroma.Web.TwitterAPI.Representers.BaseRepresenter do to_map(object, %{}) end - def enum_to_json(enum) do enum_to_json(enum, %{}) end + def enum_to_json(enum) do + enum_to_json(enum, %{}) + end + def enum_to_json(enum, options) do enum |> enum_to_list(options) - |> Poison.encode! - end - - def format_asctime(date) do - Strftime.strftime!(date, "%a %b %d %H:%M:%S %z %Y") - end - - def date_to_asctime(date) do - with {:ok, date, _offset} <- date |> DateTime.from_iso8601 do - format_asctime(date) - else _e -> - "" - end + |> Jason.encode!() end end end