Class: Rapns::Gcm::PayloadDataSizeValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/rapns/gcm/payload_data_size_validator.rb

Constant Summary collapse

LIMIT =
4096

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



6
7
8
9
10
# File 'lib/rapns/gcm/payload_data_size_validator.rb', line 6

def validate(record)
  if record.payload_data_size > LIMIT
    record.errors[:base] << "GCM notification payload data cannot be larger than #{LIMIT} bytes."
  end
end