Class: SpreeCmCommissioner::CustomerContentNotification

Inherits:
NoticedFcmBase
  • Object
show all
Defined in:
app/notifications/spree_cm_commissioner/customer_content_notification.rb

Instance Method Summary collapse

Methods inherited from NoticedFcmBase

#android_settings, #apns_settings, #cleanup_device_token, #convert_hash_values_to_str, #fcm_credentials, #fcm_device_tokens, #format_for_database, #format_notification, #payload

Instance Method Details

#customer_notificationObject



15
16
17
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 15

def customer_notification
  params[:customer_notification]
end

#extra_payloadObject



19
20
21
22
23
24
25
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 19

def extra_payload
  {
    customer_notification_id: customer_notification.id,
    url: customer_notification.url,
    notification_type: params[:customer_notification][:notification_type]
  }
end

#image_urlObject

overrided



6
7
8
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 6

def image_url
  customer_notification.push_notification_image_url
end

#messageObject



34
35
36
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 34

def message
  record.params[:translatable_options][:message]
end

#notificableObject

overrided



11
12
13
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 11

def notificable
  customer_notification
end

#titleObject



38
39
40
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 38

def title
  record.params[:translatable_options][:title]
end

#translatable_optionsObject



27
28
29
30
31
32
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 27

def translatable_options
  {
    title: customer_notification.title,
    message: customer_notification.excerpt
  }
end

#typeObject



42
43
44
# File 'app/notifications/spree_cm_commissioner/customer_content_notification.rb', line 42

def type
  'customer_notification'
end