Method: Preneeds::Applicant#mailing_address

Defined in:
app/models/preneeds/applicant.rb

#mailing_addressPreneeds::Address

Returns applicant’s mailing address.

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/models/preneeds/applicant.rb', line 19

class Applicant < Preneeds::Base
  attribute :applicant_email, String
  attribute :applicant_phone_number, String
  attribute :applicant_relationship_to_claimant, String
  attribute :completing_reason, String, default: 'vets.gov application'

  attribute :mailing_address, Preneeds::Address
  attribute :name, Preneeds::FullName

  # (see Preneeds::BurialForm#as_eoas)
  #
  def as_eoas
    {
      applicantEmail: applicant_email, applicantPhoneNumber: applicant_phone_number,
      applicantRelationshipToClaimant: applicant_relationship_to_claimant,
      completingReason: completing_reason, mailingAddress: mailing_address&.as_eoas,
      name: name&.as_eoas
    }
  end

  # List of permitted params for use with Strong Parameters
  #
  # @return [Array] array of class attributes as symbols
  #
  def self.permitted_params
    [
      :applicant_email, :applicant_phone_number, :applicant_relationship_to_claimant, :completing_reason,
      { mailing_address: Preneeds::Address.permitted_params, name: Preneeds::FullName.permitted_params }
    ]
  end
end