Class: MailHandler::Models::Email
- Inherits:
-
Object
- Object
- MailHandler::Models::Email
- Defined in:
- lib/models/email.rb
Overview
PORO for mutating email information
Instance Attribute Summary collapse
-
#bcc ⇒ Object
readonly
Returns the value of attribute bcc.
-
#bounce_to ⇒ Object
readonly
Returns the value of attribute bounce_to.
-
#cc ⇒ Object
readonly
Returns the value of attribute cc.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#reply_to ⇒ Object
readonly
Returns the value of attribute reply_to.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(email_hash = {}) ⇒ Email
constructor
A new instance of Email.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(email_hash = {}) ⇒ Email
Returns a new instance of Email.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/models/email.rb', line 8 def initialize(email_hash = {}) @from = email_hash[:from] @to = email_hash[:to] @cc = email_hash[:cc] @bcc = email_hash[:bcc] @subject = email_hash[:subject] @text = email_hash[:text] @html = email_hash[:html] @reply_to = email_hash[:reply_to] @bounce_to = email_hash[:bounce_to] end |
Instance Attribute Details
#bcc ⇒ Object (readonly)
Returns the value of attribute bcc.
5 6 7 |
# File 'lib/models/email.rb', line 5 def bcc @bcc end |
#bounce_to ⇒ Object (readonly)
Returns the value of attribute bounce_to.
5 6 7 |
# File 'lib/models/email.rb', line 5 def bounce_to @bounce_to end |
#cc ⇒ Object (readonly)
Returns the value of attribute cc.
5 6 7 |
# File 'lib/models/email.rb', line 5 def cc @cc end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
5 6 7 |
# File 'lib/models/email.rb', line 5 def from @from end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
5 6 7 |
# File 'lib/models/email.rb', line 5 def html @html end |
#reply_to ⇒ Object (readonly)
Returns the value of attribute reply_to.
5 6 7 |
# File 'lib/models/email.rb', line 5 def reply_to @reply_to end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/models/email.rb', line 5 def subject @subject end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/models/email.rb', line 5 def text @text end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
5 6 7 |
# File 'lib/models/email.rb', line 5 def to @to end |
Instance Method Details
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/models/email.rb', line 23 def to_h { from: from, to: to, cc: cc, bcc: bcc, subject: subject, html_body: html, text_body: text, return_path: bounce_to, reply: reply_to }.delete_if { |_, v| v.nil? } end |
#to_s ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/models/email.rb', line 35 def to_s { from: from, to: to, subject: subject }.to_s end |