about summary refs log tree commit diff
path: root/app/serializers/rest/web_push_subscription_serializer.rb
blob: 7fd952a567bf62d1f37ab030b25d3e551ab0e2f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class REST::WebPushSubscriptionSerializer < ActiveModel::Serializer
  attributes :id, :endpoint, :alerts, :server_key

  def alerts
    object.data&.dig('alerts') || {}
  end

  def server_key
    Rails.configuration.x.vapid_public_key
  end
end