Class: ActionPushWeb::Subscription
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ActionPushWeb::Subscription
- 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_ip ⇒ Object
24 25 26 27 28 29 30 31 32 |
# 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 = Surfguard.resolve_public_ips(endpoint_uri&.host).first rescue Surfguard::Unresolvable # A host that resolves to nothing has no usable public IP, same outcome as # one whose only addresses are blocked: no endpoint IP to pin, which fails # endpoint validation. Push has no lookup-failed surface to distinguish. @resolved_endpoint_ip = nil end |