Class: MyTradeWizard::Email
- Inherits:
-
Object
- Object
- MyTradeWizard::Email
- Defined in:
- lib/mytradewizard/email.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/mytradewizard/email.rb', line 7 def body @body end |
#subject ⇒ Object
Returns the value of attribute subject.
6 7 8 |
# File 'lib/mytradewizard/email.rb', line 6 def subject @subject end |
Instance Method Details
#<<(msg) ⇒ Object
9 10 11 |
# File 'lib/mytradewizard/email.rb', line 9 def <<(msg) @body << msg << "\n" end |
#send ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mytradewizard/email.rb', line 13 def send to = MyTradeWizard::Configuration::Email::TO subject = @subject body = @body username = MyTradeWizard::Configuration::Email::GMAIL_USERNAME password = MyTradeWizard::Configuration::Email::GMAIL_PASSWORD unless to.empty? || username.empty? || password.empty? Gmail.connect!(username, password) do |gmail| gmail.deliver! do to(to) subject(subject) body(body) end end end end |