Class: Rpush::Client::ActiveModel::Apns::BinaryNotificationValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/rpush/client/active_model/apns/binary_notification_validator.rb

Constant Summary collapse

MAX_BYTES =
2048

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



8
9
10
11
# File 'lib/rpush/client/active_model/apns/binary_notification_validator.rb', line 8

def validate(record)
  return unless record.payload.bytesize > MAX_BYTES
  record.errors[:base] << "APN notification cannot be larger than #{MAX_BYTES} bytes. Try condensing your alert and device attributes."
end