Class: Communify::Workers::PushNotificationService

Inherits:
Object
  • Object
show all
Defined in:
lib/communify/workers/push_notification_worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_id, notification_type, custom_data) ⇒ PushNotificationService

Returns a new instance of PushNotificationService.



18
19
20
21
22
23
24
25
# File 'lib/communify/workers/push_notification_worker.rb', line 18

def initialize(resource_id, notification_type, custom_data)
  @resource = CommunifyLog.find(resource_id)
  @notification_type = notification_type
  @custom_data = custom_data
  @fcm_client = Fcmpush.new(ENV['FCM_PROJECT_ID'])
  @notification_status = []
  @response_ids = []
end

Instance Method Details

#callObject



27
28
29
30
31
32
# File 'lib/communify/workers/push_notification_worker.rb', line 27

def call
    device_tokens.each do |token|
      send_notification(token)
    end
    update_resource
end