Class: ActionPushWeb::Subscription

Inherits:
ApplicationRecord
  • Object
show all
Includes:
ActiveSupport::Rescuable
Defined in:
app/models/action_push_web/subscription.rb

Constant Summary collapse

PERMITTED_ENDPOINT_HOSTS =
%w[
  jmt17.google.com
  fcm.googleapis.com
  updates.push.services.mozilla.com
  web.push.apple.com
  notify.windows.com
].freeze

Instance Method Summary collapse

Instance Method Details

#push(notification) ⇒ Object



20
21
22
# File 'app/models/action_push_web/subscription.rb', line 20

def push(notification)
  ActionPushWeb.push(SubscriptionNotification.new(notification:, subscription: self))
end

#resolved_endpoint_ipObject



24
25
26
27
# File 'app/models/action_push_web/subscription.rb', line 24

def resolved_endpoint_ip
  return @resolved_endpoint_ip if defined?(@resolved_endpoint_ip)
  @resolved_endpoint_ip = SsrfProtection.resolve_public_ip(endpoint_uri&.host)
end