Class: BGSDependents::Child
- Inherits:
-
Base
- Object
- Common::Base
- Base
- BGSDependents::Child
- 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
-
#child_income ⇒ String
Did this child have income in the last 365 days.
-
#ever_married_ind ⇒ String
Y/N indicates whether the person has ever been married.
-
#family_relationship_type ⇒ String
Family relationship type: Biological/Stepchild/Adopted Child/Other.
-
#first ⇒ String
The person’s first name.
-
#last ⇒ String
The person’s last name.
-
#middle ⇒ String
The person’s middle name.
-
#place_of_birth_city ⇒ String
City where child was born.
-
#place_of_birth_state ⇒ String
State where child was born.
-
#reason_marriage_ended ⇒ String
Reason child marriage ended.
-
#ssn ⇒ String
The person’s social security number.
-
#suffix ⇒ String
The person’s name suffix.
Attributes inherited from Common::Base
Instance Method Summary collapse
-
#address(dependents_application) ⇒ Hash
Sets a hash with address information based on the submitted form information.
- #child_attributes ⇒ Object private
- #child_status ⇒ Object private
-
#format_info ⇒ Hash
Sets a hash with child attributes.
-
#initialize(child_info) ⇒ Child
constructor
A new instance of Child.
- #marriage_indicator ⇒ Object private
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_income ⇒ String
Returns 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_ind ⇒ String
Returns 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_type ⇒ String
Returns family relationship type: Biological/Stepchild/Adopted Child/Other.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#first ⇒ String
Returns the person’s first name.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#last ⇒ String
Returns the person’s last name.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#middle ⇒ String
Returns the person’s middle name.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#place_of_birth_city ⇒ String
Returns city where child was born.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#place_of_birth_state ⇒ String
Returns state where child was born.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#reason_marriage_ended ⇒ String
Returns reason child marriage ended.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#ssn ⇒ String
Returns the person’s social security number.
30 |
# File 'app/models/bgs_dependents/child.rb', line 30 attribute :ssn, String |
#suffix ⇒ String
Returns 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
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 |
#child_attributes ⇒ Object (private)
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/models/bgs_dependents/child.rb', line 86 def child_attributes { ssn: @child_info['ssn'], birth_date: @child_info['birth_date'], family_relationship_type: child_status, place_of_birth_country: @child_info.dig('place_of_birth', 'country'), place_of_birth_state: @child_info.dig('place_of_birth', 'state'), place_of_birth_city: @child_info.dig('place_of_birth', 'city'), reason_marriage_ended: @child_info.dig('previous_marriage_details', 'reason_marriage_ended'), ever_married_ind: marriage_indicator, child_income: formatted_boolean(@child_info['child_income']), not_self_sufficient: formatted_boolean(@child_info['not_self_sufficient']) }.merge(@child_info['full_name']) end |
#child_status ⇒ Object (private)
101 102 103 |
# File 'app/models/bgs_dependents/child.rb', line 101 def child_status CHILD_STATUS[@child_info['child_status']&.key(true)] end |
#format_info ⇒ Hash
Sets a hash with child attributes
67 68 69 |
# File 'app/models/bgs_dependents/child.rb', line 67 def format_info attributes.with_indifferent_access end |
#marriage_indicator ⇒ Object (private)
105 106 107 |
# File 'app/models/bgs_dependents/child.rb', line 105 def marriage_indicator @child_info['previously_married'] == 'Yes' ? 'Y' : 'N' end |