Class: PersonalInformationSerializer

Inherits:
Object
  • Object
show all
Includes:
JSONAPI::Serializer
Defined in:
app/serializers/personal_information_serializer.rb

Instance Method Summary collapse

Instance Method Details

#birth_dateString

Returns the veteran’s birth date. Object is an instance of the MPI::Models::MviProfile class.

Returns:

  • (String)

    For example, ‘1949-03-04’



17
18
19
# File 'app/serializers/personal_information_serializer.rb', line 17

attribute :birth_date do |object|
  object.demographics&.birth_date&.to_date&.to_s
end

#gender_identityObject

Returns the veteran’s gender identity.

Returns:

  • (Object)

    For example, code: ‘F’, name: ‘Female’



33
34
35
36
37
38
39
40
# File 'app/serializers/personal_information_serializer.rb', line 33

attribute :gender_identity do |object|
  return {} if object.demographics&.gender_identity&.nil?

  {
    code: object.demographics&.gender_identity&.code,
    name: object.demographics&.gender_identity&.name
  }
end

#preferred_nameString

Returns the veteran’s preferred name.

Returns:

  • (String)

    For example, ‘SAM’



25
26
27
# File 'app/serializers/personal_information_serializer.rb', line 25

attribute :preferred_name do |object|
  object.demographics&.preferred_name&.text
end