Sha256: bb3441d16301c7c91d673ed92494ec846a2cfba169152733011df03bd0671a26

Contents?: true

Size: 1011 Bytes

Versions: 28

Compression:

Stored size: 1011 Bytes

Contents

module Rpush
  module Client
    module ActiveModel
      module Pushy
        module Notification
          def self.included(base)
            base.instance_eval do
              alias_attribute :time_to_live, :expiry

              validates :time_to_live, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
              validates :registration_ids, presence: true
              validates :data, presence: true

              validates_with Rpush::Client::ActiveModel::Pushy::TimeToLiveValidator
              validates_with Rpush::Client::ActiveModel::PayloadDataSizeValidator, limit: 4096
              validates_with Rpush::Client::ActiveModel::RegistrationIdsCountValidator, limit: 1000
            end
          end

          def as_json(_options = nil)
            {
              'data'             => data,
              'time_to_live'     => time_to_live,
              'registration_ids' => registration_ids
            }
          end
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
rpush-9.1.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-9.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-8.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-7.0.1 lib/rpush/client/active_model/pushy/notification.rb
rpush-7.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-6.0.1 lib/rpush/client/active_model/pushy/notification.rb
rpush-6.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-5.4.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-5.3.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-5.2.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-5.1.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-5.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-4.2.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-4.1.1 lib/rpush/client/active_model/pushy/notification.rb
rpush-4.1.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-4.0.1 lib/rpush/client/active_model/pushy/notification.rb
rpush-4.0.0 lib/rpush/client/active_model/pushy/notification.rb
rpush-3.3.1 lib/rpush/client/active_model/pushy/notification.rb
rpush-3.3.0 lib/rpush/client/active_model/pushy/notification.rb
rpush_extended-3.2.6 lib/rpush/client/active_model/pushy/notification.rb