Class: JellyfishNotification::SimpleListener

Inherits:
Object
  • Object
show all
Defined in:
lib/jellyfish_notification/simple_listener.rb

Instance Method Summary collapse

Instance Method Details

#publish_order_create(order, current_user) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/jellyfish_notification/simple_listener.rb', line 25

def publish_order_create(order, current_user)
  order_creator = current_user.email
  if ENV['JELLYFISH_ASYNCHRONOUS_DELIVERY'] == 'true'
    JellyfishMailer.delay.publish_order_create(order, order_creator)
  else
    JellyfishMailer.publish_order_create(order, order_creator).deliver_now
  end
end

#publish_project_approval_update(project) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/jellyfish_notification/simple_listener.rb', line 16

def publish_project_approval_update(project)
  project_approvers = Staff.admin.pluck(:email).join(', ')
  if ENV['JELLYFISH_ASYNCHRONOUS_DELIVERY'] == 'true'
    JellyfishMailer.delay.publish_project_approval_update(project, project_approvers)
  else
    JellyfishMailer.publish_project_approval_update(project, project_approvers).deliver_now
  end
end

#publish_project_create(project, current_user) ⇒ Object

IF ‘JELLYFISH_ASYNCHRONOUS_DELIVERY’ IS true THEN MAIL GETS ADDED TO DELAYED JOBS



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/jellyfish_notification/simple_listener.rb', line 4

def publish_project_create(project, current_user)
  project_approvers = Staff.admin.pluck(:email).join(', ')
  project_creator = current_user.email
  if ENV['JELLYFISH_ASYNCHRONOUS_DELIVERY'] == 'true'
    JellyfishMailer.delay.publish_project_create_confirmation(project, project_creator)
    JellyfishMailer.delay.publish_project_create_approvers(project, project_approvers)
  else
    JellyfishMailer.publish_project_create_confirmation(project, project_creator).deliver_now
    JellyfishMailer.publish_project_create_approvers(project, project_approvers).deliver_now
  end
end