Class: BGSDependents::Spouse

Inherits:
Base show all
Defined in:
app/models/bgs_dependents/spouse.rb

Constant Summary

Constants inherited from Base

Base::MILITARY_POST_OFFICE_TYPE_CODES

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods inherited from Base

#adjust_address_lines_for!, #adjust_country_name_for!, #create_address_params, #create_person_params, #dependent_address, #format_date, #formatted_boolean, #generate_address, #relationship_type, #serialize_dependent_result

Methods inherited from Common::Base

#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes

Constructor Details

#initialize(dependents_application) ⇒ Spouse

Returns a new instance of Spouse.



45
46
47
48
49
50
# File 'app/models/bgs_dependents/spouse.rb', line 45

def initialize(dependents_application)
  @dependents_application = dependents_application
  @spouse_information = @dependents_application['spouse_information']

  self.attributes = spouse_attributes
end

Instance Attribute Details

#addressHash

Returns the person’s address.

Returns:

  • (Hash)

    the person’s address



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#birth_dateString

Returns the person’s birth date.

Returns:

  • (String)

    the person’s birth date



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#ever_married_indString

Returns Y/N indicates whether the person has ever been married.

Returns:

  • (String)

    Y/N indicates whether the person has ever been married



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#firstString

Returns the person’s first name.

Returns:

  • (String)

    the person’s first name



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#lastString

Returns the person’s last name.

Returns:

  • (String)

    the person’s last name



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#martl_status_type_cdString

Returns marital status type: Married, Divorced, Widowed, Separated, Never Married.

Returns:

  • (String)

    marital status type: Married, Divorced, Widowed, Separated, Never Married



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#middleString

Returns the person’s middle name.

Returns:

  • (String)

    the person’s middle name



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#spouse_incomeString

Returns did this spouse have income in the last 365 days.

Returns:

  • (String)

    did this spouse have income in the last 365 days



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#ssnString

Returns the person’s social security number.

Returns:

  • (String)

    the person’s social security number



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#suffixString

Returns the person’s name suffix.

Returns:

  • (String)

    the person’s name suffix



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#va_file_numberString

Returns the person’s va file number.

Returns:

  • (String)

    the person’s va file number



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

#vet_indString

Returns Y/N indicates whether the person is a veteran.

Returns:

  • (String)

    Y/N indicates whether the person is a veteran



32
# File 'app/models/bgs_dependents/spouse.rb', line 32

attribute :ssn, String

Instance Method Details

#format_infoHash

Sets a hash with spouse attributes

Returns:

  • (Hash)

    spouse attributes including name, address and marital info



56
57
58
# File 'app/models/bgs_dependents/spouse.rb', line 56

def format_info
  attributes.with_indifferent_access
end

#lives_with_vetObject (private)



81
82
83
# File 'app/models/bgs_dependents/spouse.rb', line 81

def lives_with_vet
  @dependents_application['does_live_with_spouse']['spouse_does_live_with_veteran']
end

#marital_statusObject (private)



89
90
91
# File 'app/models/bgs_dependents/spouse.rb', line 89

def marital_status
  lives_with_vet ? 'Married' : 'Separated'
end

#spouse_addressObject (private)



93
94
95
96
97
98
99
# File 'app/models/bgs_dependents/spouse.rb', line 93

def spouse_address
  dependent_address(
    dependents_application: @dependents_application,
    lives_with_vet: @dependents_application['does_live_with_spouse']['spouse_does_live_with_veteran'],
    alt_address: @dependents_application.dig('does_live_with_spouse', 'address')
  )
end

#spouse_attributesHash (private)

Sets a hash with spouse attributes

Returns:

  • (Hash)

    spouse info including name and address info



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/bgs_dependents/spouse.rb', line 66

def spouse_attributes
  spouse_info = {
    ssn: @spouse_information['ssn'],
    birth_date: @spouse_information['birth_date'],
    ever_married_ind: 'Y',
    martl_status_type_cd: marital_status,
    vet_ind: spouse_is_veteran,
    address: spouse_address,
    spouse_income: formatted_boolean(@dependents_application['does_live_with_spouse']['spouse_income'])
  }.merge(@spouse_information['full_name'])
  spouse_info.merge!({ va_file_number: @spouse_information['va_file_number'] }) if spouse_is_veteran == 'Y'

  spouse_info
end

#spouse_is_veteranObject (private)



85
86
87
# File 'app/models/bgs_dependents/spouse.rb', line 85

def spouse_is_veteran
  @spouse_information['is_veteran'] ? 'Y' : 'N'
end