Class: EcoRake::Utils::Mailer::ProviderBase

Inherits:
Object
  • Object
show all
Defined in:
lib/eco-rake/utils/mailer/provider_base.rb

Direct Known Subclasses

AwsProvider, SendgridProvider

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.to_desc(to: nil, cc: nil, bcc: nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/eco-rake/utils/mailer/provider_base.rb', line 6

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

Instance Method Details

#fetch_to(value = nil) ⇒ Object



20
21
22
# File 'lib/eco-rake/utils/mailer/provider_base.rb', line 20

def fetch_to(value = nil)
  value
end

#send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



16
17
18
# File 'lib/eco-rake/utils/mailer/provider_base.rb', line 16

def send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) # rubocop:disable Lint/UnusedMethodArgument
  raise "You must implement this method"
end