class Urbanairship::Push::Push
A Push
Notification.
Attributes
audience[RW]
campaigns[RW]
client[W]
device_types[RW]
in_app[RW]
localizations[RW]
message[RW]
notification[RW]
options[RW]
Public Class Methods
new(client)
click to toggle source
Initialize a Push
Object
@param [Object] client
# File lib/urbanairship/push/push.rb, line 28 def initialize(client) @client = client end
Public Instance Methods
payload()
click to toggle source
# File lib/urbanairship/push/push.rb, line 32 def payload compact_helper({ audience: audience, notification: notification, options: options, device_types: device_types, message: message, in_app: in_app, campaigns: campaigns, localizations: localizations }) end
send_push()
click to toggle source
Send the Push
Object
@raise [AirshipFailure] if the request failed @raise [Unauthorized] if authentication failed @raise [Forbidden] if app does not have entitlement @return [PushResponse] with `push_ids` and other response data.
# File lib/urbanairship/push/push.rb, line 51 def send_push response = @client.send_request( method: 'POST', body: JSON.dump(payload), path: push_path, content_type: 'application/json' ) pr = PushResponse.new(http_response_body: response['body'], http_response_code: response['code'].to_s) logger.info { pr.format } pr end