Class: BGSDependents::Child

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

Constant Summary collapse

CHILD_STATUS =
{
  'stepchild' => 'Stepchild',
  'biological' => 'Biological',
  'adopted' => 'Adopted Child',
  'disabled' => 'Other',
  'child_under18' => 'Other',
  'child_over18_in_school' => 'Other'
}.freeze

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(child_info) ⇒ Child

Returns a new instance of Child.



58
59
60
61
# File 'app/models/bgs_dependents/child.rb', line 58

def initialize(child_info)
  @child_info = child_info
  self.attributes = child_attributes
end

Instance Attribute Details

#child_incomeString

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

Returns:

  • (String)

    did this child have income in the last 365 days



30
# File 'app/models/bgs_dependents/child.rb', line 30

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



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#family_relationship_typeString

Returns family relationship type: Biological/Stepchild/Adopted Child/Other.

Returns:

  • (String)

    family relationship type: Biological/Stepchild/Adopted Child/Other



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#firstString

Returns the person’s first name.

Returns:

  • (String)

    the person’s first name



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#lastString

Returns the person’s last name.

Returns:

  • (String)

    the person’s last name



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#middleString

Returns the person’s middle name.

Returns:

  • (String)

    the person’s middle name



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#place_of_birth_cityString

Returns city where child was born.

Returns:

  • (String)

    city where child was born



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#place_of_birth_stateString

Returns state where child was born.

Returns:

  • (String)

    state where child was born



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#reason_marriage_endedString

Returns reason child marriage ended.

Returns:

  • (String)

    reason child marriage ended



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#ssnString

Returns the person’s social security number.

Returns:

  • (String)

    the person’s social security number



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

#suffixString

Returns the person’s name suffix.

Returns:

  • (String)

    the person’s name suffix



30
# File 'app/models/bgs_dependents/child.rb', line 30

attribute :ssn, String

Instance Method Details

#address(dependents_application) ⇒ Hash

Sets a hash with address information based on the submitted form information

Parameters:

  • dependents_application (Hash)

    the submitted form information

Returns:

  • (Hash)

    child address



76
77
78
79
80
81
82
# File 'app/models/bgs_dependents/child.rb', line 76

def address(dependents_application)
  dependent_address(
    dependents_application:,
    lives_with_vet: @child_info['does_child_live_with_you'],
    alt_address: @child_info.dig('child_address_info', 'address')
  )
end

#format_infoHash

Sets a hash with child attributes

Returns:

  • (Hash)

    child attributes including name, address and birth info



67
68
69
# File 'app/models/bgs_dependents/child.rb', line 67

def format_info
  attributes.with_indifferent_access
end