class SendGridActionMailerAdapter::Converters::Attachments

Public Instance Methods

assign_attributes(sendgrid_mail, value) click to toggle source
# File lib/sendgrid_actionmailer_adapter/converters/attachments.rb, line 26
def assign_attributes(sendgrid_mail, value)
  Array(value).each do |attachment|
    sendgrid_mail.add_attachment(attachment)
  end
end
convert(mail) click to toggle source
# File lib/sendgrid_actionmailer_adapter/converters/attachments.rb, line 13
def convert(mail)
  mail.attachments.map do |attachment|
    ::SendGrid::Attachment.new.tap do |sendgrid_attachment|
      sendgrid_attachment.type = attachment.mime_type
      sendgrid_attachment.content = ::Base64.strict_encode64(attachment.body.raw_source)
      sendgrid_attachment.filename = ::Mail::Encodings.decode_encode(
        attachment.content_type_parameters['filename'], :decode
      )
      sendgrid_attachment.content_id = attachment.cid
    end
  end
end
validate(_mail) click to toggle source
# File lib/sendgrid_actionmailer_adapter/converters/attachments.rb, line 10
def validate(_mail)
end