Module: Rpush::Client::ActiveModel::Wns::Notification

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

WNS_PRIORITY_HIGH =
1
WNS_PRIORITY_MEDIUM =
2
WNS_PRIORITY_LOW =
3
WNS_PRIORITY_VERY_LOW =
4
WNS_PRIORITIES =
[WNS_PRIORITY_HIGH, WNS_PRIORITY_MEDIUM, WNS_PRIORITY_LOW, WNS_PRIORITY_VERY_LOW]

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/rpush/client/active_model/wns/notification.rb', line 26

def self.included(base)
  base.instance_eval do
    include InstanceMethods

    validates :uri, presence: true
    validates :uri, format: { with: %r{https?://[\S]+} }
    validates :data, presence: true, unless: :skip_data_validation?
    validates :priority, inclusion: { in: WNS_PRIORITIES }, allow_nil: true
  end
end