Class: Burials::NotificationEmail

Inherits:
VANotify::NotificationEmail::SavedClaim show all
Defined in:
lib/va_notify/notification_email/burial.rb

Overview

Instance Attribute Summary

Attributes inherited from VANotify::NotificationEmail::SavedClaim

#claim, #email_template_id, #email_type

Instance Method Summary collapse

Methods inherited from VANotify::NotificationEmail::SavedClaim

#claim_class, #deliver, #email, #enqueue_email, #flipper_enabled?, #monitoring, #send_email, #valid_attempt?, #vanotify_service

Constructor Details

#initialize(saved_claim_id) ⇒ NotificationEmail

Returns a new instance of NotificationEmail.

See Also:

  • VANotify::NotificationEmail::SavedClaim#new


10
11
12
# File 'lib/va_notify/notification_email/burial.rb', line 10

def initialize(saved_claim_id)
  super(saved_claim_id, service_name: 'burials')
end

Instance Method Details

#personalizationObject (private)



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/va_notify/notification_email/burial.rb', line 17

def personalization
  default = super

  facility_name, street_address, city_state_zip = claim.regional_office
  veteran_name = "#{claim.veteran_first_name} #{claim.veteran_last_name&.first}"
  benefits_claimed = " - #{claim.benefits_claimed.join(" \n - ")}"

  burials = {
    # confirmation
    'form_name' => 'Burial Benefit Claim (Form 21P-530)',
    'deceased_veteran_first_name_last_initial' => veteran_name,
    'benefits_claimed' => benefits_claimed,
    'facility_name' => facility_name,
    'street_address' => street_address,
    'city_state_zip' => city_state_zip,
    # confirmation, error
    'first_name' => claim.claimaint_first_name&.upcase
  }

  default.merge(burials)
end