Module: Webpush
- Defined in:
- lib/webpush.rb,
lib/webpush/request.rb,
lib/webpush/version.rb,
lib/webpush/encryption.rb
Defined Under Namespace
Modules: Encryption Classes: InvalidSubscription, Request, ResponseError
Constant Summary collapse
- GCM_URL =
It is temporary URL until supported by the GCM server.
'https://android.googleapis.com/gcm/send'
- TEMP_GCM_URL =
'https://gcm-http.googleapis.com/gcm'
- VERSION =
"0.2.3"
Class Method Summary collapse
-
.payload_send(endpoint:, message: "", p256dh: "", auth: "", **options) ⇒ Object
Deliver the payload to the required endpoint given by the JavaScript PushSubscription.
Class Method Details
.payload_send(endpoint:, message: "", p256dh: "", auth: "", **options) ⇒ Object
Deliver the payload to the required endpoint given by the JavaScript PushSubscription. Including an optional message requires p256dh and auth keys from the PushSubscription.
29 30 31 32 33 34 35 |
# File 'lib/webpush.rb', line 29 def payload_send(endpoint:, message: "", p256dh: "", auth: "", **) endpoint = endpoint.gsub(GCM_URL, TEMP_GCM_URL) payload = build_payload(, p256dh, auth) Webpush::Request.new(endpoint, .merge(payload: payload)).perform end |