Class: Griddler::Email
- Inherits:
-
Object
- Object
- Griddler::Email
- Includes:
- ActionView::Helpers::SanitizeHelper
- Defined in:
- lib/griddler/email.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#bcc ⇒ Object
readonly
Returns the value of attribute bcc.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#cc ⇒ Object
readonly
Returns the value of attribute cc.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#original_recipient ⇒ Object
readonly
Returns the value of attribute original_recipient.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#raw_headers ⇒ Object
readonly
Returns the value of attribute raw_headers.
-
#raw_html ⇒ Object
readonly
Returns the value of attribute raw_html.
-
#raw_text ⇒ Object
readonly
Returns the value of attribute raw_text.
-
#reply_to ⇒ Object
readonly
Returns the value of attribute reply_to.
-
#spam_report ⇒ Object
readonly
Returns the value of attribute spam_report.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#vendor_specific ⇒ Object
readonly
Returns the value of attribute vendor_specific.
Instance Method Summary collapse
-
#initialize(params) ⇒ Email
constructor
A new instance of Email.
- #spam_score ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(params) ⇒ Email
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/griddler/email.rb', line 24 def initialize(params) @params = params @to = recipients(:to) @from = extract_address(params[:from]) @subject = extract_subject @body = extract_body @raw_text = params[:text] @raw_html = params[:html] @raw_body = @raw_text.presence || @raw_html @headers = extract_headers @cc = recipients(:cc) @bcc = recipients(:bcc) @original_recipient = extract_address(params[:original_recipient]) @reply_to = extract_address(params[:reply_to]) @raw_headers = params[:headers] = params[:attachments] @vendor_specific = params.fetch(:vendor_specific, {}) @spam_report = params[:spam_report] end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def end |
#bcc ⇒ Object (readonly)
Returns the value of attribute bcc.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def bcc @bcc end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def body @body end |
#cc ⇒ Object (readonly)
Returns the value of attribute cc.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def cc @cc end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def from @from end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def headers @headers end |
#original_recipient ⇒ Object (readonly)
Returns the value of attribute original_recipient.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def original_recipient @original_recipient end |
#raw_body ⇒ Object (readonly)
Returns the value of attribute raw_body.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def raw_body @raw_body end |
#raw_headers ⇒ Object (readonly)
Returns the value of attribute raw_headers.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def raw_headers @raw_headers end |
#raw_html ⇒ Object (readonly)
Returns the value of attribute raw_html.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def raw_html @raw_html end |
#raw_text ⇒ Object (readonly)
Returns the value of attribute raw_text.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def raw_text @raw_text end |
#reply_to ⇒ Object (readonly)
Returns the value of attribute reply_to.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def reply_to @reply_to end |
#spam_report ⇒ Object (readonly)
Returns the value of attribute spam_report.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def spam_report @spam_report end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def subject @subject end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def to @to end |
#vendor_specific ⇒ Object (readonly)
Returns the value of attribute vendor_specific.
7 8 9 |
# File 'lib/griddler/email.rb', line 7 def vendor_specific @vendor_specific end |
Instance Method Details
#spam_score ⇒ Object
72 73 74 |
# File 'lib/griddler/email.rb', line 72 def spam_score @spam_report[:score] if @spam_report end |
#to_h ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/griddler/email.rb', line 52 def to_h @to_h ||= { to: to, from: from, cc: cc, bcc: bcc, subject: subject, body: body, raw_body: raw_body, raw_text: raw_text, raw_html: raw_html, headers: headers, raw_headers: raw_headers, attachments: , vendor_specific: vendor_specific, spam_score: spam_score, spam_report: spam_report, } end |