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.
20 21 22 23 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 20 def initialize(config, logger:) @config = config @logger = logger end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
18 19 20 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 18 def config @config end |
Class Method Details
.to_desc(to: nil, cc: nil, bcc: nil) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 5 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
29 30 31 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 29 def fetch_to(value = nil) value || config.mailer.to || env_credential(:to) end |
#send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
25 26 27 |
# File 'lib/eco/api/common/session/mailer/provider_base.rb', line 25 def send_mail(subject:, body:, to: nil, cc: nil, bcc: nil) # rubocop:disable Lint/UnusedMethodArgument raise 'You must implement this method' end |