class ApnsGatling::Message
Constants
Attributes
alert[RW]
apns_collapse_id[RW]
apns_id[RW]
badge[RW]
category[RW]
content_available[RW]
custom_payload[RW]
expiration[RW]
mutable_content[RW]
priority[RW]
sound[RW]
thread_id[RW]
token[R]
topic[RW]
Public Class Methods
new(token)
click to toggle source
# File lib/apns_gatling/message.rb, line 13 def initialize(token) @token = token @apns_id = SecureRandom.uuid end
Public Instance Methods
payload()
click to toggle source
# File lib/apns_gatling/message.rb, line 26 def payload aps = {} aps.merge!(alert: alert) if alert aps.merge!(badge: badge) if badge aps.merge!(sound: sound) if sound aps.merge!(category: category) if category aps.merge!('content-available' => content_available) if content_available aps.merge!('mutable-content' => mutable_content) if mutable_content aps.merge!('thread-id' => thread_id) if thread_id message = {aps: aps} message.merge!(custom_payload) if custom_payload message end
payload_data()
click to toggle source
# File lib/apns_gatling/message.rb, line 18 def payload_data payload.to_json.force_encoding(Encoding::BINARY) end
valid?()
click to toggle source
# File lib/apns_gatling/message.rb, line 22 def valid? data.bytesize <= MAXIMUM_PAYLOAD_SIZE end