Class: EmailParams::BaseEmailParams

Inherits:
Object
  • Object
show all
Defined in:
app/notifications/email_params/base_email_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_notification_configuration:, reference_event:, recipient:) ⇒ BaseEmailParams

Returns a new instance of BaseEmailParams.



5
6
7
8
9
10
11
12
13
# File 'app/notifications/email_params/base_email_params.rb', line 5

def initialize(
  event_notification_configuration:,
  reference_event:,
  recipient:
)
  @event_notification_configuration = event_notification_configuration
  @reference_event = reference_event
  @recipient = recipient
end

Instance Attribute Details

#event_notification_configurationObject (readonly)

Returns the value of attribute event_notification_configuration.



3
4
5
# File 'app/notifications/email_params/base_email_params.rb', line 3

def event_notification_configuration
  @event_notification_configuration
end

#recipientObject (readonly)

Returns the value of attribute recipient.



3
4
5
# File 'app/notifications/email_params/base_email_params.rb', line 3

def recipient
  @recipient
end

#reference_eventObject (readonly)

Returns the value of attribute reference_event.



3
4
5
# File 'app/notifications/email_params/base_email_params.rb', line 3

def reference_event
  @reference_event
end

Instance Method Details

#formatted_event_start_dateObject



32
33
34
# File 'app/notifications/email_params/base_email_params.rb', line 32

def formatted_event_start_date
  reference_event.formatted_created_date
end

#fromObject



19
20
21
# File 'app/notifications/email_params/base_email_params.rb', line 19

def from
  Rails.application.config.from_email_address
end

#subjectObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'app/notifications/email_params/base_email_params.rb', line 15

def subject
  raise NotImplementedError
end

#template_nameObject



27
28
29
30
# File 'app/notifications/email_params/base_email_params.rb', line 27

def template_name
  event_slug = @reference_event.slug
  event_slug.downcase
end

#toObject



23
24
25
# File 'app/notifications/email_params/base_email_params.rb', line 23

def to
  @recipient.email
end