Class: SendGridActionMailerAdapter::Converters::Contents

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid_actionmailer_adapter/converters/contents.rb

Instance Method Summary collapse

Instance Method Details

#assign_attributes(sendgrid_mail, value) ⇒ Object



16
17
18
19
20
# File 'lib/sendgrid_actionmailer_adapter/converters/contents.rb', line 16

def assign_attributes(sendgrid_mail, value)
  Array(value).each do |content|
    sendgrid_mail.add_content(content)
  end
end

#convert(mail) ⇒ Object



11
12
13
14
# File 'lib/sendgrid_actionmailer_adapter/converters/contents.rb', line 11

def convert(mail)
  contents = mail.body.multipart? ? mail.body.parts.select(&:text?) : [mail]
  contents.map { |c| ::SendGrid::Content.new(type: c.mime_type, value: c.body.to_s) }
end

#validate(_mail) ⇒ Object



8
9
# File 'lib/sendgrid_actionmailer_adapter/converters/contents.rb', line 8

def validate(_mail)
end