Sha256: 3e9d8874f6ac63b5d2072c586f1e91ecc1b5467da1cc2f4615b79e1ad36d14c7

Contents?: true

Size: 383 Bytes

Versions: 28

Compression:

Stored size: 383 Bytes

Contents

module Rpush
  module Client
    module ActiveModel
      module Pushy
        class TimeToLiveValidator < ::ActiveModel::Validator
          def validate(record)
            return if record.time_to_live.blank? || record.time_to_live <= 1.year.seconds
            record.errors.add(:time_to_live, 'The maximum value is 1 year')
          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/time_to_live_validator.rb
rpush-9.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-8.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-7.0.1 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-7.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-6.0.1 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-6.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-5.4.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-5.3.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-5.2.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-5.1.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-5.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-4.2.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-4.1.1 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-4.1.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-4.0.1 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-4.0.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-3.3.1 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush-3.3.0 lib/rpush/client/active_model/pushy/time_to_live_validator.rb
rpush_extended-3.2.6 lib/rpush/client/active_model/pushy/time_to_live_validator.rb