Class: DoSnapshot::Mail
- Inherits:
-
Object
- Object
- DoSnapshot::Mail
- 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
Constructor Details
#initialize(options = {}) ⇒ Mail
Returns a new instance of Mail.
14 15 16 |
# File 'lib/do_snapshot/mail.rb', line 14 def initialize( = {}) .each { |key, option| send("#{key}=", option) } end |
Instance Attribute Details
#mailer ⇒ Object
23 24 25 |
# File 'lib/do_snapshot/mail.rb', line 23 def mailer @mailer ||= Pony.method(:mail) end |
#opts_default=(value) ⇒ Object
Sets the attribute opts_default
12 13 14 |
# File 'lib/do_snapshot/mail.rb', line 12 def opts_default=(value) @opts_default = value end |
#smtp_default=(value) ⇒ Object
Sets the attribute smtp_default
12 13 14 |
# File 'lib/do_snapshot/mail.rb', line 12 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
51 52 53 54 55 56 |
# File 'lib/do_snapshot/mail.rb', line 51 def notify setup_notify logger.debug 'Sending e-mail notification.' # Look into your inbox :) mailer.call(opts) end |
#opts ⇒ Object
31 32 33 |
# File 'lib/do_snapshot/mail.rb', line 31 def opts @opts ||= opts_default.dup end |
#opts=(options) ⇒ Object
41 42 43 44 45 |
# File 'lib/do_snapshot/mail.rb', line 41 def opts=() .each_pair do |key, value| opts[key.to_sym] = value end if end |
#reset_options ⇒ Object
18 19 20 21 |
# File 'lib/do_snapshot/mail.rb', line 18 def @opts = opts_default @smtp = smtp_default end |
#smtp ⇒ Object
27 28 29 |
# File 'lib/do_snapshot/mail.rb', line 27 def smtp @smtp ||= smtp_default.dup end |
#smtp=(options) ⇒ Object
35 36 37 38 39 |
# File 'lib/do_snapshot/mail.rb', line 35 def smtp=() .each_pair do |key, value| smtp[key.to_sym] = value end if end |