Class: DoSnapshot::Mail
- Inherits:
-
Object
- Object
- DoSnapshot::Mail
- Includes:
- Helpers
- Defined in:
- lib/do_snapshot/mail.rb
Overview
Shared mailer.
Instance Attribute Summary collapse
- #mailer ⇒ Object
-
#opts_default ⇒ Object
writeonly
Sets the attribute opts_default.
-
#smtp_default ⇒ Object
writeonly
Sets the attribute smtp_default.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Mail
constructor
A new instance of Mail.
-
#notify ⇒ Object
Sending message via Hash params.
- #opts ⇒ Object
- #opts=(options) ⇒ Object
- #reset_options ⇒ Object
- #smtp ⇒ Object
- #smtp=(options) ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = {}) ⇒ Mail
15 16 17 |
# File 'lib/do_snapshot/mail.rb', line 15 def initialize( = {}) .each { |key, option| send("#{key}=", option) } end |
Instance Attribute Details
#mailer ⇒ Object
24 25 26 |
# File 'lib/do_snapshot/mail.rb', line 24 def mailer @mailer ||= Pony.method(:mail) end |
#opts_default=(value) ⇒ Object
Sets the attribute opts_default
13 14 15 |
# File 'lib/do_snapshot/mail.rb', line 13 def opts_default=(value) @opts_default = value end |
#smtp_default=(value) ⇒ Object
Sets the attribute smtp_default
13 14 15 |
# File 'lib/do_snapshot/mail.rb', line 13 def smtp_default=(value) @smtp_default = value end |
Instance Method Details
#notify ⇒ Object
Sending message via Hash params.
- Options
-
–mail to:[email protected] from:[email protected] –smtp address:smtp.gmail.com user_name:someuser password:somepassword
52 53 54 55 56 57 |
# File 'lib/do_snapshot/mail.rb', line 52 def notify setup_notify logger.debug 'Sending e-mail notification.' # Look into your inbox :) mailer.call(opts) end |
#opts ⇒ Object
32 33 34 |
# File 'lib/do_snapshot/mail.rb', line 32 def opts @opts ||= opts_default.dup end |
#opts=(options) ⇒ Object
42 43 44 45 46 |
# File 'lib/do_snapshot/mail.rb', line 42 def opts=() .each_pair do |key, value| opts[key.to_sym] = value end if end |
#reset_options ⇒ Object
19 20 21 22 |
# File 'lib/do_snapshot/mail.rb', line 19 def @opts = opts_default @smtp = smtp_default end |
#smtp ⇒ Object
28 29 30 |
# File 'lib/do_snapshot/mail.rb', line 28 def smtp @smtp ||= smtp_default.dup end |
#smtp=(options) ⇒ Object
36 37 38 39 40 |
# File 'lib/do_snapshot/mail.rb', line 36 def smtp=() .each_pair do |key, value| smtp[key.to_sym] = value end if end |