Class: BenefitsEducation::Response

Inherits:
Common::Base show all
Includes:
SentryLogging
Defined in:
lib/lighthouse/benefits_education/response.rb

Overview

Model for the GIBS status response

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Methods inherited from Common::Base

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

Constructor Details

#initialize(_status, response = nil) ⇒ Response

Returns a new instance of Response.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/lighthouse/benefits_education/response.rb', line 60

def initialize(_status, response = nil)
  @response = response
  key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                  'date_time_of_birth' => 'date_of_birth' }
  attributes = if contains_education_info?
                 response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
               else
                 {}
               end
  attributes.transform_keys! { |key| key_mapping[key] || key }
  super(attributes)
end

Instance Attribute Details

#active_dutyBoolean

Returns Is the user on active duty.

Returns:

  • (Boolean)

    Is the user on active duty



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#date_of_birthString

Returns User’s date of birth.

Returns:

  • (String)

    User’s date of birth



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#delimiting_dateString

Returns The date after which benefits cannot be paid.

Returns:

  • (String)

    The date after which benefits cannot be paid



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#eligibility_dateString

Returns The date at which benefits are eligible to be paid.

Returns:

  • (String)

    The date at which benefits are eligible to be paid



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#enrollmentsArray[Enrollment]

Returns An array of the user’s enrollments.

Returns:

  • (Array[Enrollment])

    An array of the user’s enrollments



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#first_nameString

Returns User’s first name.

Returns:

  • (String)

    User’s first name



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#last_nameString

Returns User’s last name.

Returns:

  • (String)

    User’s last name



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#name_suffixObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#original_entitlementEntitlement

Returns The time span of the user’s original entitlement.

Returns:

  • (Entitlement)

    The time span of the user’s original entitlement



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#percentage_benefitInteger

Returns The amount of the benefit the user is eligible for.

Returns:

  • (Integer)

    The amount of the benefit the user is eligible for



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#regional_processing_officeString

Returns Closest processing office to the user.

Returns:

  • (String)

    Closest processing office to the user



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#remaining_entitlementEntitlement

Returns The amount of entitlement time the user has remaining.

Returns:

  • (Entitlement)

    The amount of entitlement time the user has remaining



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#used_entitlementEntitlement

Returns The amount of entitlement time the user has already used.

Returns:

  • (Entitlement)

    The amount of entitlement time the user has already used



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#va_file_numberString

Returns User’s VA file number.

Returns:

  • (String)

    User’s VA file number



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

#veteran_is_eligibleBoolean

Returns Is the user eligbile for the benefit.

Returns:

  • (Boolean)

    Is the user eligbile for the benefit



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lighthouse/benefits_education/response.rb', line 41

class Response < Common::Base
  include SentryLogging

  attribute :first_name, String
  attribute :last_name, String
  attribute :name_suffix, String
  attribute :date_of_birth, String
  attribute :va_file_number, String
  attribute :regional_processing_office, String
  attribute :eligibility_date, String
  attribute :delimiting_date, String
  attribute :percentage_benefit, Integer
  attribute :original_entitlement, Entitlement
  attribute :used_entitlement, Entitlement
  attribute :remaining_entitlement, Entitlement
  attribute :veteran_is_eligible, Boolean
  attribute :active_duty, Boolean
  attribute :enrollments, Array[Enrollment]

  def initialize(_status, response = nil)
    @response = response
    key_mapping = { 'eligibility_date_time' => 'eligibility_date', 'delimiting_date_time' => 'delimiting_date',
                    'date_time_of_birth' => 'date_of_birth' }
    attributes = if contains_education_info?
                   response.body['chapter33EducationInfo'].deep_transform_keys!(&:underscore)
                 else
                   {}
                 end
    attributes.transform_keys! { |key| key_mapping[key] || key }
    super(attributes)
  end

  def contains_education_info?
    return false if @response.nil?

    @response.body.key?('chapter33EducationInfo') == true &&
      @response.body['chapter33EducationInfo'] != {} &&
      !@response.body['chapter33EducationInfo'].nil?
  end
end

Instance Method Details

#contains_education_info?Boolean

Returns:

  • (Boolean)


73
74
75
76
77
78
79
# File 'lib/lighthouse/benefits_education/response.rb', line 73

def contains_education_info?
  return false if @response.nil?

  @response.body.key?('chapter33EducationInfo') == true &&
    @response.body['chapter33EducationInfo'] != {} &&
    !@response.body['chapter33EducationInfo'].nil?
end