account_serializer.rb 732 B

123456789101112131415161718192021222324252627282930313233
  1. # frozen_string_literal: true
  2. class REST::AccountSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. attributes :id, :username, :acct, :display_name, :locked, :created_at,
  5. :note, :url, :avatar, :avatar_static, :header, :header_static,
  6. :followers_count, :following_count, :statuses_count
  7. def note
  8. Formatter.instance.simplified_format(object)
  9. end
  10. def url
  11. TagManager.instance.url_for(object)
  12. end
  13. def avatar
  14. full_asset_url(object.avatar_original_url)
  15. end
  16. def avatar_static
  17. full_asset_url(object.avatar_static_url)
  18. end
  19. def header
  20. full_asset_url(object.header_original_url)
  21. end
  22. def header_static
  23. full_asset_url(object.header_static_url)
  24. end
  25. end