Class: VAProfile::Response
- Inherits:
-
Common::Base
- Object
- Common::Base
- VAProfile::Response
- Includes:
- Common::Client::Concerns::ServiceStatus
- Defined in:
- lib/va_profile/response.rb
Direct Known Subclasses
ContactInformation::PersonResponse, ContactInformation::TransactionResponse, Demographics::DemographicResponse, Demographics::GenderIdentityResponse, Demographics::PreferredNameResponse, MilitaryPersonnel::ServiceHistoryResponse, Profile::V3::HealthBenefitBioResponse, Profile::V3::MilitaryOccupationResponse, V2::ContactInformation::PersonResponse, V2::ContactInformation::TransactionResponse, VeteranStatus::VeteranStatusResponse
Constant Summary
Constants included from Common::Client::Concerns::ServiceStatus
Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS
Instance Attribute Summary
Attributes inherited from Common::Base
Instance Method Summary collapse
- #cache? ⇒ Boolean
-
#initialize(status, attributes = nil) ⇒ Response
constructor
A new instance of Response.
- #metadata ⇒ Object
- #ok? ⇒ Boolean
- #response_status ⇒ Object
Methods inherited from Common::Base
#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes
Constructor Details
#initialize(status, attributes = nil) ⇒ Response
Returns a new instance of Response.
12 13 14 15 |
# File 'lib/va_profile/response.rb', line 12 def initialize(status, attributes = nil) super(attributes) if attributes self.status = status end |
Instance Method Details
#cache? ⇒ Boolean
21 22 23 |
# File 'lib/va_profile/response.rb', line 21 def cache? ok? end |
#metadata ⇒ Object
25 26 27 |
# File 'lib/va_profile/response.rb', line 25 def { status: response_status } end |
#ok? ⇒ Boolean
17 18 19 |
# File 'lib/va_profile/response.rb', line 17 def ok? status == 200 end |
#response_status ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/va_profile/response.rb', line 29 def response_status case status when 200 RESPONSE_STATUS[:ok] when 403 RESPONSE_STATUS[:not_authorized] when 404 RESPONSE_STATUS[:not_found] else RESPONSE_STATUS[:server_error] end end |