Class: VAProfile::ContactInformation::PersonResponse

Inherits:
Response show all
Defined in:
lib/va_profile/contact_information/person_response.rb

Constant Summary

Constants included from Common::Client::Concerns::ServiceStatus

Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS

Instance Attribute Summary collapse

Attributes inherited from Common::Base

#errors_hash, #metadata

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Response

#initialize, #metadata, #ok?, #response_status

Methods inherited from Common::Base

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

Constructor Details

This class inherits a constructor from VAProfile::Response

Instance Attribute Details

#response_bodyObject (readonly)

Returns the value of attribute response_body.



11
12
13
# File 'lib/va_profile/contact_information/person_response.rb', line 11

def response_body
  @response_body
end

Class Method Details

.from(raw_response = nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/va_profile/contact_information/person_response.rb', line 13

def self.from(raw_response = nil)
  @response_body = raw_response&.body

  new(
    raw_response&.status,
    person: VAProfile::Models::Person.build_from(@response_body&.dig('bio'))
  )
end

Instance Method Details

#cache?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/va_profile/contact_information/person_response.rb', line 22

def cache?
  super || (status >= 400 && status < 500)
end