Module: NotifyOn::EmailSupport
- Included in:
- Notification
- Defined in:
- app/models/concerns/notify_on/email_support.rb
Instance Method Summary collapse
- #email_attachments ⇒ Object
- #email_from ⇒ Object
- #email_subject ⇒ Object
- #email_template ⇒ Object
- #send_email! ⇒ Object
- #should_save_email_id? ⇒ Boolean
Instance Method Details
#email_attachments ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/models/concerns/notify_on/email_support.rb', line 29 def = [] return unless email_config? && email_config. email_config..each do |name, renderer| next unless trigger.send(renderer.if) if renderer.try(:if?) filename = begin trigger.send(name) rescue => e name end begin file = if renderer.is_a?(Symbol) trigger.send(renderer) else trigger.send(renderer.file) end rescue => e raise "Could not create file: #{filename}\n#{e}" end << { :name => filename, :file => file } end end |
#email_from ⇒ Object
16 17 18 |
# File 'app/models/concerns/notify_on/email_support.rb', line 16 def email_from convert_string(email_from_raw) end |
#email_subject ⇒ Object
20 21 22 23 |
# File 'app/models/concerns/notify_on/email_support.rb', line 20 def email_subject return email_config.subject if email_config? && email_config.subject? description end |
#email_template ⇒ Object
11 12 13 14 |
# File 'app/models/concerns/notify_on/email_support.rb', line 11 def email_template return nil unless email_config? email_config.template || 'notify' end |
#send_email! ⇒ Object
4 5 6 7 8 9 |
# File 'app/models/concerns/notify_on/email_support.rb', line 4 def send_email! return false unless can_send_email? NotifyOn.configuration.mailer_class.constantize .notify(id, email_template, ) .send("deliver_#{email_delivery_timing}") end |
#should_save_email_id? ⇒ Boolean
25 26 27 |
# File 'app/models/concerns/notify_on/email_support.rb', line 25 def should_save_email_id? email_config? && email_config.save_id? end |