Class: EVSS::Letters::BeneficiaryResponse
- Inherits:
-
Response
- Object
- Common::Base
- Response
- EVSS::Letters::BeneficiaryResponse
- Defined in:
- lib/evss/letters/beneficiary_response.rb
Overview
Model for beneficiary responses.
Constant Summary
Constants included from Common::Client::Concerns::ServiceStatus
Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS
Instance Attribute Summary collapse
-
#benefit_information ⇒ EVSS::Letters::BenefitInformation
The user’s benefit information.
- #military_service ⇒ Object
Attributes inherited from Common::Base
Instance Method Summary collapse
-
#initialize(status, response = nil) ⇒ BeneficiaryResponse
constructor
A new instance of BeneficiaryResponse.
- #veteran_attributes?(attrs) ⇒ Boolean private
Methods inherited from Response
#cache?, #metadata, #ok?, #response_status
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) ⇒ BeneficiaryResponse
Returns a new instance of BeneficiaryResponse.
27 28 29 30 |
# File 'lib/evss/letters/beneficiary_response.rb', line 27 def initialize(status, response = nil) attributes = response.body if response super(status, attributes) end |
Instance Attribute Details
#benefit_information ⇒ EVSS::Letters::BenefitInformation
Returns The user’s benefit information.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/evss/letters/beneficiary_response.rb', line 23 class BeneficiaryResponse < EVSS::Response attribute :benefit_information, EVSS::Letters::BenefitInformation attribute :military_service, Array[EVSS::Letters::MilitaryService] def initialize(status, response = nil) attributes = response.body if response super(status, attributes) end def benefit_information=(attrs) if veteran_attributes?(attrs) super EVSS::Letters::BenefitInformationVeteran.new(attrs) else super EVSS::Letters::BenefitInformationDependent.new(attrs) end end private def veteran_attributes?(attrs) attrs.key? 'has_service_connected_disabilities' end end |
#military_service ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/evss/letters/beneficiary_response.rb', line 23 class BeneficiaryResponse < EVSS::Response attribute :benefit_information, EVSS::Letters::BenefitInformation attribute :military_service, Array[EVSS::Letters::MilitaryService] def initialize(status, response = nil) attributes = response.body if response super(status, attributes) end def benefit_information=(attrs) if veteran_attributes?(attrs) super EVSS::Letters::BenefitInformationVeteran.new(attrs) else super EVSS::Letters::BenefitInformationDependent.new(attrs) end end private def veteran_attributes?(attrs) attrs.key? 'has_service_connected_disabilities' end end |
Instance Method Details
#veteran_attributes?(attrs) ⇒ Boolean (private)
42 43 44 |
# File 'lib/evss/letters/beneficiary_response.rb', line 42 def veteran_attributes?(attrs) attrs.key? 'has_service_connected_disabilities' end |