Class: Backup::Notifier::Mail
Instance Attribute Summary collapse
-
#address ⇒ Object
The address to use Example: smtp.gmail.com.
-
#authentication ⇒ Object
Authentication type Example: plain.
-
#domain ⇒ Object
Your domain (if applicable) Example: mydomain.com.
-
#enable_starttls_auto ⇒ Object
Automatically set TLS Example: true.
-
#from ⇒ Object
Sender and Receiver email addresses Examples: sender - [email protected] receiver - [email protected].
-
#mail ⇒ Object
Container for the Mail object.
-
#model ⇒ Object
Container for the Model object.
-
#password ⇒ Object
Username and Password (sender email’s credentials) Examples: user_name - meskyanichi password - my_secret_password.
-
#port ⇒ Object
The port to connect to Example: 587.
-
#to ⇒ Object
Sender and Receiver email addresses Examples: sender - [email protected] receiver - [email protected].
-
#user_name ⇒ Object
Username and Password (sender email’s credentials) Examples: user_name - meskyanichi password - my_secret_password.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(&block) ⇒ Mail
constructor
Instantiates a new Backup::Notifier::Mail object.
-
#perform!(model, exception = false) ⇒ Object
Performs the notification Takes an exception object that might’ve been created if an exception occurred.
Methods inherited from Base
Methods included from Configuration::Helpers
#clear_defaults!, #getter_methods, #load_defaults!, #setter_methods
Constructor Details
#initialize(&block) ⇒ Mail
Instantiates a new Backup::Notifier::Mail object
61 62 63 64 65 66 67 |
# File 'lib/backup/notifier/mail.rb', line 61 def initialize(&block) load_defaults! instance_eval(&block) if block_given? set_defaults! end |
Instance Attribute Details
#address ⇒ Object
The address to use Example: smtp.gmail.com
30 31 32 |
# File 'lib/backup/notifier/mail.rb', line 30 def address @address end |
#authentication ⇒ Object
Authentication type Example: plain
52 53 54 |
# File 'lib/backup/notifier/mail.rb', line 52 def authentication @authentication end |
#domain ⇒ Object
Your domain (if applicable) Example: mydomain.com
40 41 42 |
# File 'lib/backup/notifier/mail.rb', line 40 def domain @domain end |
#enable_starttls_auto ⇒ Object
Automatically set TLS Example: true
57 58 59 |
# File 'lib/backup/notifier/mail.rb', line 57 def enable_starttls_auto @enable_starttls_auto end |
#from ⇒ Object
Sender and Receiver email addresses Examples:
sender - [email protected]
receiver - [email protected]
25 26 27 |
# File 'lib/backup/notifier/mail.rb', line 25 def from @from end |
#mail ⇒ Object
Container for the Mail object
14 15 16 |
# File 'lib/backup/notifier/mail.rb', line 14 def mail @mail end |
#model ⇒ Object
Container for the Model object
18 19 20 |
# File 'lib/backup/notifier/mail.rb', line 18 def model @model end |
#password ⇒ Object
Username and Password (sender email’s credentials) Examples:
user_name - meskyanichi
password - my_secret_password
47 48 49 |
# File 'lib/backup/notifier/mail.rb', line 47 def password @password end |
#port ⇒ Object
The port to connect to Example: 587
35 36 37 |
# File 'lib/backup/notifier/mail.rb', line 35 def port @port end |
#to ⇒ Object
Sender and Receiver email addresses Examples:
sender - [email protected]
receiver - [email protected]
25 26 27 |
# File 'lib/backup/notifier/mail.rb', line 25 def to @to end |
#user_name ⇒ Object
Username and Password (sender email’s credentials) Examples:
user_name - meskyanichi
password - my_secret_password
47 48 49 |
# File 'lib/backup/notifier/mail.rb', line 47 def user_name @user_name end |
Instance Method Details
#perform!(model, exception = false) ⇒ Object
Performs the notification Takes an exception object that might’ve been created if an exception occurred. If this is the case it’ll invoke notify_failure!(exception), otherwise, if no error was raised, it’ll go ahead and notify_success!
If’ll only perform these if on_success is true or on_failure is true
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/backup/notifier/mail.rb', line 76 def perform!(model, exception = false) @model = model if notify_on_success? and exception.eql?(false) log! notify_success! elsif notify_on_failure? and not exception.eql?(false) log! notify_failure!(exception) end end |