Sha256: 9e8000c6195588cb443c8d8a6e90a0c471acd2ab4e7695322387ba94e1efdc76
Contents?: true
Size: 1.67 KB
Versions: 7
Compression:
Stored size: 1.67 KB
Contents
module Eco module API module Common module Session class Mailer class ProviderBase class << self def to_desc(to: nil, cc: nil, bcc: nil) cc_to = [cc].flatten.compact.uniq bcc_to = [bcc].flatten.compact.uniq { to_addresses: [to].flatten.compact.uniq }.tap do |dest| dest.merge!(cc_addresses: cc_to) unless cc_to.empty? dest.merge!(bcc_addresses: bcc_to) unless bcc_to.empty? end end end include Eco::Language::AuxiliarLogger attr_reader :config def initialize(config, logger:) @config = config @logger = logger end def send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) # rubocop:disable Lint/UnusedMethodArgument raise "You must implement this method" end def fetch_to(value = nil) value || config.mailer.to end private def credentials raise "You must implement this method" end def fetch_from(value = nil) value || config.mailer.from end def fetch_access_key_id env_mail(:id) || config.mailer.access_key_id end def fetch_secret_access_key env_mail(:key) || config.mailer.secret_access_key end def env_mail(prop) ENV[credentials[prop]] end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems