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.
13 14 15 |
# File 'lib/do_snapshot/mail.rb', line 13 def initialize( = {}) .each { |key, option| send("#{key}=", option) } end |
Instance Attribute Details
#mailer ⇒ Object
22 23 24 |
# File 'lib/do_snapshot/mail.rb', line 22 def mailer @mailer ||= Pony.method(:mail) end |
#opts_default=(value) ⇒ Object
Sets the attribute opts_default
11 12 13 |
# File 'lib/do_snapshot/mail.rb', line 11 def opts_default=(value) @opts_default = value end |
#smtp_default=(value) ⇒ Object
Sets the attribute smtp_default
11 12 13 |
# File 'lib/do_snapshot/mail.rb', line 11 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
50 51 52 53 54 55 |
# File 'lib/do_snapshot/mail.rb', line 50 def notify setup_notify logger.debug 'Sending e-mail notification.' # Look into your inbox :) mailer.call(opts) end |
#opts ⇒ Object
30 31 32 |
# File 'lib/do_snapshot/mail.rb', line 30 def opts @opts ||= opts_default.dup end |
#opts=(options) ⇒ Object
40 41 42 43 44 |
# File 'lib/do_snapshot/mail.rb', line 40 def opts=() .each_pair do |key, value| opts[key.to_sym] = value end if end |
#reset_options ⇒ Object
17 18 19 20 |
# File 'lib/do_snapshot/mail.rb', line 17 def @opts = opts_default @smtp = smtp_default end |
#smtp ⇒ Object
26 27 28 |
# File 'lib/do_snapshot/mail.rb', line 26 def smtp @smtp ||= smtp_default.dup end |
#smtp=(options) ⇒ Object
34 35 36 37 38 |
# File 'lib/do_snapshot/mail.rb', line 34 def smtp=() .each_pair do |key, value| smtp[key.to_sym] = value end if end |