application_serializer.rb 511 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. class REST::ApplicationSerializer < ActiveModel::Serializer
  3. attributes :id, :name, :website, :scopes, :redirect_uri,
  4. :client_id, :client_secret
  5. # NOTE: Deprecated in 4.3.0, needs to be removed in 5.0.0
  6. attribute :vapid_key
  7. def id
  8. object.id.to_s
  9. end
  10. def client_id
  11. object.uid
  12. end
  13. def client_secret
  14. object.secret
  15. end
  16. def website
  17. object.website.presence
  18. end
  19. def vapid_key
  20. Rails.configuration.x.vapid_public_key
  21. end
  22. end