Class: PushToSNS::PushNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/push_to_sns/push_notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ PushNotifier

Returns a new instance of PushNotifier.



3
4
5
6
7
# File 'lib/push_to_sns/push_notifier.rb', line 3

def initialize(params = {})
  params.each do |attr, value|
    public_send("#{attr}=", value)
  end
end

Instance Method Details

#deliverObject



9
10
11
12
13
# File 'lib/push_to_sns/push_notifier.rb', line 9

def deliver
  devices.each do |device|
    SendPushNotification.new(device).perform(full_notification_for_device(device))
  end
end

#devicesObject



15
16
17
# File 'lib/push_to_sns/push_notifier.rb', line 15

def devices
  raise "Please implement the method :devices to be able to load devices to notify."
end

#notification(device) ⇒ Object



19
20
21
# File 'lib/push_to_sns/push_notifier.rb', line 19

def notification(device)
  raise "Please implement the method :notification with the message to send"
end