Class: SendgridNotification::BaseMailer

Inherits:
Object
  • Object
show all
Defined in:
app/models/sendgrid_notification/base_mailer.rb

Direct Known Subclasses

NullMailer, SendgridMailer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ BaseMailer

Returns a new instance of BaseMailer.



5
6
7
8
9
# File 'app/models/sendgrid_notification/base_mailer.rb', line 5

def initialize(params = {})
  _params = params.with_indifferent_access
  @from      = _params.fetch(:mail_from) { Rails.application.config.sendgrid_notification.mail_from }
  @from_name = _params.fetch(:mail_from_name) { Rails.application.config.sendgrid_notification.mail_from_name }
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



3
4
5
# File 'app/models/sendgrid_notification/base_mailer.rb', line 3

def from
  @from
end

#from_nameObject (readonly)

Returns the value of attribute from_name.



3
4
5
# File 'app/models/sendgrid_notification/base_mailer.rb', line 3

def from_name
  @from_name
end

Instance Method Details

#last_resultObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'app/models/sendgrid_notification/base_mailer.rb', line 20

def last_result
  raise NotImplementedError, "you should implement #{self.class}##{__method__}"
end

#last_result_success?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


24
25
26
# File 'app/models/sendgrid_notification/base_mailer.rb', line 24

def last_result_success?
  raise NotImplementedError, "you should implement #{self.class}##{__method__}"
end

#sendmail(to, notification_mail, params, attachments = []) ⇒ Object

Send mail about: to recipent to notification_mail NotificationMail object for mail expression params params for notification_mail attachments attachment in hash or SendgridNotification::Attachment

Raises:

  • (NotImplementedError)


16
17
18
# File 'app/models/sendgrid_notification/base_mailer.rb', line 16

def sendmail(to, notification_mail, params, attachments = [])
  raise NotImplementedError, "you should implement #{self.class}##{__method__}"
end