Sha256: 3612f9fa373e059a3de7416697977da718c579d012ac437654c49dfbbff26f7a
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true module Mail class SES # Builds options for Aws::SESV2::Client#send_email class OptionsBuilder # message - The Mail::Message object to be sent. # options - The Hash options which override any defaults # from the message. def initialize(message, options = {}) @message = message @options = options end # Returns the options for Aws::SESV2::Client#send_email. def build message_options.merge(ses_options) end private def ses_options slice_hash(@options, *RAW_EMAIL_ATTRS) end def message_options { from_email_address: @message.from&.first, destination: { to_addresses: Array(@message.to).compact, cc_addresses: Array(@message.cc).compact, bcc_addresses: Array(@message.bcc).compact }, content: { raw: { data: @message.to_s } } }.compact end def slice_hash(hash, *keys) keys.each_with_object({}) { |k, h| h[k] = hash[k] if hash.key?(k) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mail-ses-1.0.1 | lib/mail/ses/options_builder.rb |
mail-ses-1.0.0 | lib/mail/ses/options_builder.rb |