Class: SilentBob::EmailSender
- Inherits:
-
Object
- Object
- SilentBob::EmailSender
- Defined in:
- lib/silent_bob/email_sender.rb
Constant Summary collapse
- MESSAGE_TYPE =
'email'.freeze
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(subject:, to:, body:, attachments: [], from: nil, configuration: ConfigurationKeeper.default_config) ⇒ EmailSender
constructor
Pass initialization params *
configuration:
‘SilentBob::Configuration` object *to:
Recipients email address *body:
Email body in html format *subject:
Email subject *attachments:
Email attachments *from:
Author’s email address.
Constructor Details
#initialize(subject:, to:, body:, attachments: [], from: nil, configuration: ConfigurationKeeper.default_config) ⇒ EmailSender
Pass initialization params
-
configuration:
‘SilentBob::Configuration` object -
to:
Recipients email address -
body:
Email body in html format -
subject:
Email subject -
attachments:
Email attachments -
from:
Author’s email address
14 15 16 17 18 19 20 21 22 |
# File 'lib/silent_bob/email_sender.rb', line 14 def initialize(subject:, to:, body:, attachments: [], from: nil, configuration: ConfigurationKeeper.default_config) @configuration = configuration @subject = subject @to = to @body = body @attachments = @from = from end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def @attachments end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def body @body end |
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def configuration @configuration end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def from @from end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def subject @subject end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
5 6 7 |
# File 'lib/silent_bob/email_sender.rb', line 5 def to @to end |
Instance Method Details
#call ⇒ Object
24 25 26 27 28 |
# File 'lib/silent_bob/email_sender.rb', line 24 def call raise ConfigurationNotFound unless configuration Client.new(configuration: configuration, params: email_params).call end |