Module: Rpush::Client::ActiveModel::Wpns::Notification

Included in:
Rpush::Client::ActiveRecord::Wpns::Notification, Mongoid::Wpns::Notification, Redis::Wpns::Notification
Defined in:
lib/rpush/client/active_model/wpns/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/rpush/client/active_model/wpns/notification.rb', line 6

def self.included(base)
  base.instance_eval do
    validates :uri, presence: true
    validates :uri, format: { with: %r{https?://[\S]+} }
    validates :data, presence: true
  end
  def alert=(value)
    return unless value
    data = self.data || {}
    data['title'] = value
    self.data = data
  end
end

Instance Method Details

#alert=(value) ⇒ Object



12
13
14
15
16
17
# File 'lib/rpush/client/active_model/wpns/notification.rb', line 12

def alert=(value)
  return unless value
  data = self.data || {}
  data['title'] = value
  self.data = data
end