Sha256: b04a356eccac67d12a15e74c5b58920dd5bbfe1f668f7f586381462c7eaf4440

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module Rpush
  module Adm
    class Notification < Rpush::Notification
      validates :registration_ids, :presence => true

      validates_with Rpush::PayloadDataSizeValidator, limit: 6144
      validates_with Rpush::RegistrationIdsCountValidator, limit: 100

      validates_with Rpush::Adm::DataValidator

      def as_json
        json = {
          'data' => data
        }

        if collapse_key
          json['consolidationKey'] = collapse_key
        end

        # number of seconds before message is expired
        if expiry
          json['expiresAfter'] = expiry
        end

        json
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpush-1.0.0-java lib/rpush/adm/notification.rb
rpush-1.0.0 lib/rpush/adm/notification.rb