Class: Cats::Core::AllocationNotification

Inherits:
Noticed::Base
  • Object
show all
Defined in:
app/notifications/cats/core/allocation_notification.rb

Instance Method Summary collapse

Instance Method Details

#messageObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/notifications/cats/core/allocation_notification.rb', line 13

def message
  allocation_item = params[:allocation_item]
  commodity = allocation_item.commodity.name
  source = allocation_item.source.name
  destination = allocation_item.destination.name
  title = "Allocation Notification - #{commodity}"
  date = Date.today
  body = <<~BODY
    Commodity with the following specification has been allocated to you:
        Batch No. = #{allocation_item.commodity.batch_no}
        Commodity = #{commodity}
        Quantity = #{allocation_item.quantity}
    The commodity is expected to be delivered from #{source} to #{destination}
  BODY
  {title: title, date: date, body: body}
end