Class: PdfFill::Forms::Va261880
- Includes:
- FormHelper
- Defined in:
- lib/pdf_fill/forms/va261880.rb
Constant Summary collapse
- ITERATOR =
PdfFill::HashConverter::ITERATOR
- KEY =
{ 'fullName' => { key: 'form1[0].#subform[0].NameOfVeteran[0]', limit: 40, question_num: 1, question_text: 'NAME OF VETERAN' }, 'dateOfBirth' => { key: 'form1[0].#subform[0].DateofBirth[0]', limit: 10, question_num: 2, question_suffix: 'A', question_text: 'DATE OF BIRTH' }, 'contactPhone' => { key: 'form1[0].#subform[0].DaytimePhoneNumber[0]', limit: 10, question_num: 5, question_suffix: 'A', question_text: 'PHONE NUMBER' }, 'contactEmail' => { key: 'form1[0].#subform[0].EmailAddress_IfApplicable[0]', limit: 30, question_num: 6, question_suffix: 'A', question_text: 'E-MAIL ADDRESS OF CLAIMANT' }, 'applicantAddress' => { key: 'form1[0].#subform[0].Address_NumberandStreetorRuralRoute_City_or_PO_State_ZIPCode[0]', limit: 50, question_num: 7, question_text: 'ADDRESS' }, 'identity' => { key: 'form1[0].#subform[0].RadioButtonList[1]' }, 'periodsOfService' => { limit: 3, first_key: 'militaryBranch', 'militaryBranch' => { key: 'form1[0].#subform[0].BranchOfService[%iterator%]', limit: 20, question_num: 9, question_suffix: 'C', question_text: 'BRANCH OF SERVICE' }, 'dateRangeFrom' => { key: 'form1[0].#subform[0].DateEntered[%iterator%]', limit: 14, question_num: 9, question_suffix: 'C', question_text: 'DATE ENTERED' }, 'dateRangeTo' => { key: 'form1[0].#subform[0].DateSeparated[%iterator%]', limit: 14, question_num: 9, question_suffix: 'C', question_text: 'DATE SEPARATED' } }, 'periodsOfServiceReserveGuard' => { limit: 3, first_key: 'militaryBranch', 'militaryBranch' => { key: 'form1[0].#subform[0].BranchOfServiceReserveGuard[%iterator%]', limit: 20, question_num: 9, question_suffix: 'D', question_text: 'BRANCH OF SERVICE' }, 'dateRangeFrom' => { key: 'form1[0].#subform[0].DateEnteredReserveGuard[%iterator%]', limit: 14, question_num: 9, question_suffix: 'D', question_text: 'DATE ENTERED' }, 'dateRangeTo' => { key: 'form1[0].#subform[0].DateSeparatedReserveGuard[%iterator%]', limit: 14, question_num: 9, question_suffix: 'D', question_text: 'DATE SEPARATED' } }, 'vaLoanIndicator' => { 'vaLoanIndicatorYes' => { key: 'form1[0].#subform[0].RadioButtonListYes[2]', question_num: 10, question_suffix: 'A' }, 'vaLoanIndicatorNo' => { key: 'form1[0].#subform[0].RadioButtonListNo[2]', question_num: 10, question_suffix: 'A' }, 'vaLoanIndicatorNever' => { key: 'form1[0].#subform[0].RadioButtonListNA[2]', question_num: 10, question_suffix: 'A' } }, 'relevantPriorLoans' => { limit: 2, first_key: 'dateRange', 'dateRange' => { key: 'form1[0].#subform[0].DateofVaLoan[%iterator%]', question_num: 10, question_suffix: 'B', question_text: 'Date of Loan' }, 'propertyAddress' => { key: 'form1[0].#subform[0].StreetAddressVaLoan[%iterator%]', question_num: 10, question_suffix: 'C', question_text: 'Property Address of Loan' }, 'propertyCity' => { key: 'form1[0].#subform[0].CityandStateVaLoan[%iterator%]', question_num: 10, question_suffix: 'D', question_text: 'City State of Loan' } }, 'resortationIntent' => { key: 'form1[0].#subform[0].RadioButtonList[3]', question_num: 11, question_suffix: 'A' }, 'relevantPriorLoansResortation' => { limit: 1, first_key: 'dateRange', 'dateRange' => { key: 'form1[0].#subform[0].DateofLoanRest[%iterator%]', question_num: 11, question_suffix: 'B', question_text: 'Date of Loan' }, 'propertyAddress' => { key: 'form1[0].#subform[0].StreetAddressRest[%iterator%]', question_num: 11, question_suffix: 'C', question_text: 'Address of Loan' }, 'propertyCity' => { key: 'form1[0].#subform[0].CityandStateRest[%iterator%]', question_num: 11, question_suffix: 'D', question_text: 'City and State of Loan' } }, 'cashOutIntent' => { key: 'form1[0].#subform[0].RadioButtonList[4]', question_num: 12, question_suffix: 'A' }, 'relevantPriorLoansCashOut' => { limit: 1, first_key: 'dateRange', 'dateRange' => { key: 'form1[0].#subform[0].DateofLoanCashOut[0]', question_num: 12, question_suffix: 'B', question_text: 'Date of Loan' }, 'propertyAddress' => { key: 'form1[0].#subform[0].StreetAddressCashOut[%iterator%]', question_num: 12, question_suffix: 'C', question_text: 'Address of Loan' }, 'propertyCity' => { key: 'form1[0].#subform[0].CityandStateCashOut[%iterator%]', question_num: 13, question_suffix: 'D', question_text: 'City and State of Loan' } }, 'lowerRateIntent' => { key: 'form1[0].#subform[0].RadioButtonList[5]', question_num: 13, question_suffix: 'A' }, 'relevantPriorLoansLowerRate' => { limit: 1, first_key: 'dateRange', 'dateRange' => { key: 'form1[0].#subform[0].DateofLoanIRRRL[0]', question_num: 13, question_suffix: 'B', question_text: 'Date of Loan' }, 'propertyAddress' => { key: 'form1[0].#subform[0].StreetAddressIRRRL[0]', question_num: 13, question_suffix: 'C', question_text: 'Address of Loan' }, 'propertyCity' => { key: 'form1[0].#subform[0].CityandStateIRRRL[0]', question_num: 13, question_suffix: 'D', question_text: 'City and State of Loan' } }, 'signature' => { key: 'form1[0].#subform[0].TextField1[2]', limit: 25, question_num: 14, question_suffix: 'A', question_text: 'SIGNATURE OF VETERAN' }, 'date_signed' => { key: 'form1[0].#subform[0].DateTimeField1[0]', limit: 14, question_num: 14, question_suffix: 'B', question_text: 'DATE SIGNED' } }.freeze
Instance Attribute Summary
Attributes inherited from FormBase
Instance Method Summary collapse
-
#dup_array(type, array) ⇒ Object
rubocop:enable Metrics/MethodLength rubocop:enable Layout/LineLength.
-
#expand_prior_loan_data ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Layout/LineLength.
- #map_service_date_helpers ⇒ Object
- #merge_address_helpers ⇒ Object
- #merge_fields(_options = {}) ⇒ Object
- #merge_veteran_name_helpers ⇒ Object
- #resolve_checkboxes ⇒ Object
- #resolve_reserve_guard ⇒ Object
- #set_default_checkboxes ⇒ Object
Methods included from FormHelper
#address_block, #combine_date_ranges, #expand_checkbox_as_hash, #extract_country, #extract_middle_i, #format_boolean, #select_checkbox, #select_radio_button, #split_date, #split_postal_code, #split_ssn, #validate_date
Methods inherited from FormBase
#combine_both_addr, #combine_full_address, #combine_full_address_extras, #combine_full_name, #combine_hash, #combine_name_addr, #combine_name_addr_extras, #combine_postal_code, #combine_previous_names, date_strftime, #expand_checkbox, #expand_date_range, #expand_signature, #initialize
Constructor Details
This class inherits a constructor from PdfFill::Forms::FormBase
Instance Method Details
#dup_array(type, array) ⇒ Object
rubocop:enable Metrics/MethodLength rubocop:enable Layout/LineLength
389 390 391 392 |
# File 'lib/pdf_fill/forms/va261880.rb', line 389 def dup_array(type, array) @form_data[type] = Hash.new { |h, k| h[k] = [] } @form_data[type] = array.deep_dup end |
#expand_prior_loan_data ⇒ Object
rubocop:disable Metrics/MethodLength rubocop:disable Layout/LineLength
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/pdf_fill/forms/va261880.rb', line 348 def start_finish_range = '' prior_loan_array = @form_data['relevantPriorLoans'] if prior_loan_array.present? prior_loan_array.each do |i| split_start = i['dateRange']['from'].split('-') split_paid = i['dateRange']['to'].split('-') date_range = "#{split_start[1]}-#{split_start[0]} to #{+ split_paid[1]}-#{split_paid[0]}" start_finish_range = date_range i['dateRange'] = start_finish_range loan_street_address = "#{i['propertyAddress']['propertyAddress1']} #{i['propertyAddress']['propertyAddress2']}" loan_city_address = "#{i['propertyAddress']['propertyCity']} #{i['propertyAddress']['propertyState']} #{i['propertyAddress']['propertyZip']}" i['propertyAddress'] = '' i['propertyAddress'] = loan_street_address i['propertyCity'] = '' i['propertyCity'] = loan_city_address end intent = @form_data['intent'] case intent when 'ONETIMERESTORATION' @form_data['resortationIntent'] = 1 dup_array('relevantPriorLoansResortation', prior_loan_array) when 'REFI' @form_data['cashOutIntent'] = 1 dup_array('relevantPriorLoansCashOut', prior_loan_array) when 'IRRRL' @form_data['lowerRateIntent'] = 1 dup_array('relevantPriorLoansLowerRate', prior_loan_array) end end end |
#map_service_date_helpers ⇒ Object
294 295 296 297 298 299 300 301 |
# File 'lib/pdf_fill/forms/va261880.rb', line 294 def map_service_date_helpers @form_data['periodsOfService'].each do |period| period['dateRangeFrom'] = Hash.new(0) period['dateRangeFrom'] = period['dateRange']['from'] period['dateRangeTo'] = Hash.new(0) period['dateRangeTo'] = period['dateRange']['to'] end end |
#merge_address_helpers ⇒ Object
289 290 291 292 |
# File 'lib/pdf_fill/forms/va261880.rb', line 289 def merge_address_helpers @address = combine_hash(@form_data['applicantAddress'], %w[street street2 street3 city state postalCode country]) end |
#merge_fields(_options = {}) ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/pdf_fill/forms/va261880.rb', line 270 def merge_fields( = {}) merge_veteran_name_helpers merge_address_helpers map_service_date_helpers resolve_reserve_guard resolve_checkboxes @form_data['fullName'] = @full_name @form_data['applicantAddress'] = @address @form_data['signature'] = @full_name @form_data['date_signed'] = Time.zone.today.to_s if @full_name.present? @form_data end |
#merge_veteran_name_helpers ⇒ Object
285 286 287 |
# File 'lib/pdf_fill/forms/va261880.rb', line 285 def merge_veteran_name_helpers @full_name = combine_hash(@form_data['fullName'], %w[firstName middleName lastName suffixName]) end |
#resolve_checkboxes ⇒ Object
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/pdf_fill/forms/va261880.rb', line 315 def resolve_checkboxes set_default_checkboxes previous_loan = @form_data['vaLoanIndicator'] property_owned = @form_data['propertyOwned'] if previous_loan && property_owned.nil? @form_data['vaLoanIndicator'] = { 'vaLoanIndicatorYes' => 0 } elsif previous_loan && !property_owned.nil? @form_data['vaLoanIndicator'] = { 'vaLoanIndicatorNo' => 1 } elsif !previous_loan && !previous_loan.nil? @form_data['vaLoanIndicator'] = { 'vaLoanIndicatorNever' => 2 } end veteran_status = @form_data['identity'] @form_data['identity'] = 2 unless veteran_status.nil? @form_data['identity'] = 1 if veteran_status == 'ADSM' end |
#resolve_reserve_guard ⇒ Object
303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/pdf_fill/forms/va261880.rb', line 303 def resolve_reserve_guard @form_data['periodsOfServiceReserveGuard'] = Hash.new { |h, k| h[k] = [] } array_reserve_guard, array_init = @form_data['periodsOfService'].partition do |x| x['militaryBranch'].include?('National') || x['militaryBranch'].include?('Reserve') || x['militaryBranch'].include?('Other') end @form_data['periodsOfServiceReserveGuard'] = array_reserve_guard @form_data['periodsOfService'].clear @form_data['periodsOfService'] = array_init end |
#set_default_checkboxes ⇒ Object
340 341 342 343 344 |
# File 'lib/pdf_fill/forms/va261880.rb', line 340 def set_default_checkboxes @form_data['resortationIntent'] = 2 @form_data['cashOutIntent'] = 2 @form_data['lowerRateIntent'] = 2 end |