- defp represent_activity(
- conn,
- "activity+json",
- %Activity{data: %{"type" => "Create"}} = activity,
- _user
- ) do
- object = Object.normalize(activity)
-
- conn
- |> put_resp_header("content-type", "application/activity+json")
- |> put_view(ObjectView)
- |> render("object.json", %{object: object})
- end
-
- defp represent_activity(_conn, "activity+json", _, _) do
- {:error, :not_found}
- end
-
- defp represent_activity(conn, _, activity, user) do
- response =
- activity
- |> ActivityRepresenter.to_simple_form(user, true)
- |> ActivityRepresenter.wrap_with_entry()
- |> :xmerl.export_simple(:xmerl_xml)
- |> to_string
-
- conn
- |> put_resp_content_type("application/atom+xml")
- |> send_resp(200, response)
- end
-
- def errors(conn, {:error, :not_found}) do