Class: SpreeCmCommissioner::TicketTransferReceivedNotification

Inherits:
NoticedFcmBase
  • Object
show all
Defined in:
app/notifications/spree_cm_commissioner/ticket_transfer_received_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, #image_url, #message, #payload, #title

Instance Method Details

#extra_payloadObject



11
12
13
14
15
16
17
18
19
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 11

def extra_payload
  {
    ticket_transfer_token: ticket_transfer.token,
    product_name: ticket_transfer.product&.name.to_s,
    notification_type: type,
    title: notification_title,
    message: notification_message
  }
end

#notificableObject



3
4
5
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 3

def notificable
  ticket_transfer
end

#notification_messageObject



25
26
27
28
29
30
31
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 25

def notification_message
  I18n.t(
    'notifications.spree_cm_commissioner.ticket_transfer_received_notification.message',
    product_name: ticket_transfer.product&.name.to_s,
    sender_name: ticket_transfer.from_user&.display_name.presence
  )
end

#notification_titleObject



21
22
23
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 21

def notification_title
  I18n.t('notifications.spree_cm_commissioner.ticket_transfer_received_notification.title')
end

#push_notificable?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 44

def push_notificable?
  true
end

#ticket_transferObject



7
8
9
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 7

def ticket_transfer
  @ticket_transfer ||= SpreeCmCommissioner::TicketTransfer.find(params[:ticket_transfer_id])
end

#translatable_optionsObject



33
34
35
36
37
38
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 33

def translatable_options
  {
    product_name: ticket_transfer.product&.name.to_s,
    sender_name: ticket_transfer.from_user&.display_name.presence
  }
end

#typeObject



40
41
42
# File 'app/notifications/spree_cm_commissioner/ticket_transfer_received_notification.rb', line 40

def type
  'ticket_transfer_received_notification'
end