Class: VAProfile::Models::V3::Person
- Defined in:
- lib/va_profile/models/v3/person.rb
Constant Summary
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::Person
Converts a decoded JSON response from VAProfile to an instance of the Person model.
Class Method Details
.build_from(body) ⇒ VAProfile::Models::Person
Converts a decoded JSON response from VAProfile to an instance of the Person model
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/va_profile/models/v3/person.rb', line 26 def self.build_from(body) body ||= {} addresses = body['addresses']&.map { |a| VAProfile::Models::V3::Address.build_from(a) } emails = body['emails']&.map { |e| VAProfile::Models::Email.build_from(e) } telephones = body['telephones']&.map { |t| VAProfile::Models::Telephone.build_from(t) } VAProfile::Models::V3::Person.new( created_at: body['create_date'], source_date: body['source_date'], updated_at: body['update_date'], transaction_id: body['trx_audit_id'], addresses: addresses || [], emails: emails || [], telephones: telephones || [], vet360_id: body['vet360_id'] || body['va_profile_id'], va_profile_id: body['vet360_id'] || body['va_profile_id'] ) end |