distraction.party/lib/pleroma/web/twitter_api/representers/object_representer.ex

21 lines
506 B
Elixir
Raw Normal View History

2017-03-30 14:08:49 +00:00
defmodule Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter do
use Pleroma.Web.TwitterAPI.Representers.BaseRepresenter
alias Pleroma.Object
def to_map(%Object{} = object, _opts) do
data = object.data
url = List.first(data["url"])
%{
url: url["href"],
mimetype: url["mediaType"],
2017-03-30 15:07:03 +00:00
id: data["uuid"],
2017-03-30 14:08:49 +00:00
oembed: false
}
end
2017-03-30 15:07:03 +00:00
# If we only get the naked data, wrap in an object
def to_map(%{} = data, opts) do
to_map(%Object{data: data}, opts)
end
2017-03-30 14:08:49 +00:00
end