Class: Eco::API::Common::Session::Mailer::ProviderBase
- Includes:
- Language::AuxiliarLogger
- Defined in:
- lib/eco/api/common/session/mailer/provider_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Attributes included from Language::AuxiliarLogger
Class Method Summary collapse
Instance Method Summary collapse
- #fetch_to(value = nil) ⇒ Object
-
#initialize(config, logger:) ⇒ ProviderBase
constructor
A new instance of ProviderBase.
-
#send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
Methods included from Language::AuxiliarLogger
Constructor Details
#initialize(config, logger:) ⇒ ProviderBase
Returns a new instance of ProviderBase.
22 23 24 25 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 22 def initialize(config, logger:) @config = config @logger = logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 20 def config @config end |
Class Method Details
.to_desc(to: nil, cc: nil, bcc: nil) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 8 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
31 32 33 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 31 def fetch_to(value = nil) value || config.mailer.to end |
#send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
27 28 29 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 27 def send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) # rubocop:disable Lint/UnusedMethodArgument raise "You must implement this method" end |