Class: Voltron::Notification::EmailNotification
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Voltron::Notification::EmailNotification
- Defined in:
- app/models/voltron/notification/email_notification.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#created ⇒ Object
Returns the value of attribute created.
-
#immediate ⇒ Object
Returns the value of attribute immediate.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
- #arguments(*args) ⇒ Object
- #attach(file, name = nil) ⇒ Object
- #deliver_later(options = {}) ⇒ Object
- #deliver_later!(options = {}) ⇒ Object
- #deliver_now ⇒ Object
- #deliver_now! ⇒ Object
- #mailer(klass = nil) ⇒ Object
- #method(meth = nil) ⇒ Object
- #request ⇒ Object
- #response ⇒ Object
- #template(fullpath) ⇒ Object
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
17 18 19 |
# File 'app/models/voltron/notification/email_notification.rb', line 17 def @attachments end |
#created ⇒ Object
Returns the value of attribute created.
19 20 21 |
# File 'app/models/voltron/notification/email_notification.rb', line 19 def created @created end |
#immediate ⇒ Object
Returns the value of attribute immediate.
19 20 21 |
# File 'app/models/voltron/notification/email_notification.rb', line 19 def immediate @immediate end |
#vars ⇒ Object
Returns the value of attribute vars.
17 18 19 |
# File 'app/models/voltron/notification/email_notification.rb', line 17 def vars @vars end |
Instance Method Details
#arguments(*args) ⇒ Object
51 52 53 |
# File 'app/models/voltron/notification/email_notification.rb', line 51 def arguments(*args) @mailer_arguments = *args end |
#attach(file, name = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/voltron/notification/email_notification.rb', line 29 def attach(file, name = nil) name = File.basename(file) if name.blank? path = file if file.is_a?(File) path = file.path file.close elsif !File.exist?(path) path = Voltron.asset.find(path) || path end [name] = path end |
#deliver_later(options = {}) ⇒ Object
71 72 73 74 |
# File 'app/models/voltron/notification/email_notification.rb', line 71 def deliver_later(={}) @mail_options = @delivery_method = :deliver_later end |
#deliver_later!(options = {}) ⇒ Object
76 77 78 79 |
# File 'app/models/voltron/notification/email_notification.rb', line 76 def deliver_later!(={}) @mail_options = @delivery_method = :deliver_later! end |
#deliver_now ⇒ Object
61 62 63 64 |
# File 'app/models/voltron/notification/email_notification.rb', line 61 def deliver_now @delivery_method = :deliver_now @immediate = true end |
#deliver_now! ⇒ Object
66 67 68 69 |
# File 'app/models/voltron/notification/email_notification.rb', line 66 def deliver_now! @delivery_method = :deliver_now! @immediate = true end |
#mailer(klass = nil) ⇒ Object
43 44 45 |
# File 'app/models/voltron/notification/email_notification.rb', line 43 def mailer(klass = nil) self.mailer_class = (klass || mailer_class).to_s.classify.constantize end |
#method(meth = nil) ⇒ Object
47 48 49 |
# File 'app/models/voltron/notification/email_notification.rb', line 47 def method(meth = nil) self.mailer_method = (meth || mailer_method) end |
#request ⇒ Object
21 22 23 |
# File 'app/models/voltron/notification/email_notification.rb', line 21 def request Voltron::Notification.format_output_of(request_json) end |
#response ⇒ Object
25 26 27 |
# File 'app/models/voltron/notification/email_notification.rb', line 25 def response Voltron::Notification.format_output_of(response_json) end |
#template(fullpath) ⇒ Object
55 56 57 58 59 |
# File 'app/models/voltron/notification/email_notification.rb', line 55 def template(fullpath) parts = fullpath.split('/') self.template_name = parts.pop.sub(/\.[a-z_]+\.[^\.]+$/i, '') self.template_path = parts.join('/') end |