闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
451 B

  1. # frozen_string_literal: true
  2. class REST::MediaAttachmentSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. attributes :id, :type, :url, :preview_url,
  5. :remote_url, :text_url, :meta
  6. def url
  7. full_asset_url(object.file.url(:original))
  8. end
  9. def preview_url
  10. full_asset_url(object.file.url(:small))
  11. end
  12. def text_url
  13. object.local? ? medium_url(object) : nil
  14. end
  15. def meta
  16. object.file.meta
  17. end
  18. end