Class: VAProfile::V2::ContactInformation::PersonResponse

Inherits:
Response show all
Defined in:
lib/va_profile/v2/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.



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

def response_body
  @response_body
end

Class Method Details

.from(raw_response = nil) ⇒ Object



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

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

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

Instance Method Details

#cache?Boolean

Returns:

  • (Boolean)


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

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