Sha256: 0eefd9da5a897f52680ae0ec9291944de872cccf7f4eb721865f969e966e72b5

Contents?: true

Size: 936 Bytes

Versions: 22

Compression:

Stored size: 936 Bytes

Contents

module Rpush
  module Client
    module ActiveModel
      module Gcm
        module Notification
          def self.included(base)
            base.instance_eval do
              validates :registration_ids, presence: true

              validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 4096
              validates_with Rpush::Client::ActiveModel::RegistrationIdsCountValidator, limit: 1000

              validates_with Rpush::Client::ActiveModel::Gcm::ExpiryCollapseKeyMutualInclusionValidator
            end
          end

          def as_json
            json = {
              'registration_ids' => registration_ids,
              'delay_while_idle' => delay_while_idle,
              'data' => data
            }
            json['collapse_key'] = collapse_key if collapse_key
            json['time_to_live'] = expiry if expiry
            json
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rpush-2.5.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.4.0-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.4.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.2-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.2 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.1-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.1 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.0-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.3.0.rc1 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.2.0-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.2.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.1.0-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.1.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.1-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.1 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.0-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.0 lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.0.rc1-java lib/rpush/client/active_model/gcm/notification.rb
rpush-2.0.0.rc1 lib/rpush/client/active_model/gcm/notification.rb