Class: ApnsChannel

Inherits:
Object
  • Object
show all
Defined in:
lib/notify_user/channels/apns/apns_channel.rb

Class Method Summary collapse

Class Method Details

.default_optionsObject



4
5
6
7
8
# File 'lib/notify_user/channels/apns/apns_channel.rb', line 4

def default_options
  {
    description: "Push Notifications"
  }
end

.deliver(notification, options = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/notify_user/channels/apns/apns_channel.rb', line 10

def deliver(notification, options={})
  devices = fetch_devices(notification, options[:device_method])

  NotifyUser::Apns.new([notification], devices[:ios], options).push if devices[:ios].any?
  NotifyUser::Gcm.new([notification], devices[:android], options).push if devices[:android].any?
end

.deliver_aggregated(notifications, options = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/notify_user/channels/apns/apns_channel.rb', line 17

def deliver_aggregated(notifications, options={})
  devices = fetch_devices(notifications.first, options[:device_method])

  NotifyUser::Apns.new(notifications, devices[:ios], options).push if devices[:ios].any?
  NotifyUser::Gcm.new(notifications, devices[:android], options).push if devices[:android].any?
end