Module: Parse::API::Push
- Included in:
- Client
- Defined in:
- lib/parse/api/push.rb
Overview
Defines the Parse Push notification service interface for the Parse REST API
Instance Method Summary collapse
-
#push(payload = {}, headers: {}, **opts) ⇒ Parse::Response
Send a Push notification.
Instance Method Details
#push(payload = {}, headers: {}, **opts) ⇒ Parse::Response
Send a Push notification.
Parse Server’s ‘POST /parse/push` endpoint is master-key-only —there is no session-token authorization model for sending pushes, and a no-master-key client cannot use this method. Calling it without master-key credentials returns HTTP 403 from the server; this guard fails closed in the SDK so the deployment’s configuration isn’t the only line of defense.
26 27 28 29 30 31 32 33 34 |
# File 'lib/parse/api/push.rb', line 26 def push(payload = {}, headers: {}, **opts) unless master_key.is_a?(String) && !master_key.empty? raise Parse::Error::AuthenticationError, "Parse::API::Push#push requires a master key — push notifications " \ "have no session-token authorization model in Parse Server" end opts[:use_master_key] = true unless opts.key?(:use_master_key) request :post, PUSH_PATH, body: payload.as_json, headers: headers, opts: opts end |