custom_emoji_parser.rb 385 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. class ActivityPub::Parser::CustomEmojiParser
  3. include JsonLdHelper
  4. def initialize(json)
  5. @json = json
  6. end
  7. def uri
  8. @json['id']
  9. end
  10. def shortcode
  11. @json['name']&.delete(':')
  12. end
  13. def image_remote_url
  14. @json.dig('icon', 'url')
  15. end
  16. def updated_at
  17. @json['updated']&.to_datetime
  18. rescue ArgumentError
  19. nil
  20. end
  21. end