Class: EVSS::Response
- Inherits:
-
Common::Base
- Object
- Common::Base
- EVSS::Response
- Includes:
- Common::Client::Concerns::ServiceStatus
- Defined in:
- lib/evss/response.rb
Overview
Model for EVSS responses. Body is passed straight through from the service.
Direct Known Subclasses
Dependents::RetrieveInfoResponse, DisabilityCompensationForm::FormSubmitResponse, DisabilityCompensationForm::RatedDisabilitiesResponse, DisabilityCompensationForm::RatingInfoResponse, IntentToFile::IntentToFileResponse, IntentToFile::IntentToFilesResponse, Letters::BeneficiaryResponse, Letters::LettersResponse, PCIU::EmailAddressResponse, PCIU::PhoneNumberResponse, PCIUAddress::AddressResponse, PCIUAddress::CountriesResponse, PCIUAddress::StatesResponse, PPIU::PaymentInformationResponse, EVSS::ReferenceData::IntakeSitesResponse
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.
18 19 20 21 |
# File 'lib/evss/response.rb', line 18 def initialize(status, attributes = nil) super(attributes) if attributes self.status = status end |
Instance Method Details
#cache? ⇒ Boolean
27 28 29 |
# File 'lib/evss/response.rb', line 27 def cache? ok? end |
#metadata ⇒ Object
31 32 33 |
# File 'lib/evss/response.rb', line 31 def { status: response_status } end |
#ok? ⇒ Boolean
23 24 25 |
# File 'lib/evss/response.rb', line 23 def ok? status == 200 end |
#response_status ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/evss/response.rb', line 35 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 |