Class: VAProfile::Models::Demographic
- Defined in:
- lib/va_profile/models/demographic.rb
Constant Summary
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::Demographics
Converts a decoded JSON response from VAProfile to an instance of the Demographic model.
Class Method Details
.build_from(body) ⇒ VAProfile::Models::Demographics
Converts a decoded JSON response from VAProfile to an instance of the Demographic model
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/va_profile/models/demographic.rb', line 21 def self.build_from(body) preferred_name = VAProfile::Models::PreferredName.build_from(body&.dig('preferred_name')) # VA Profile API returns collection, but there should only be a single record. gender_identity = VAProfile::Models::GenderIdentity.build_from(body&.dig('gender_identity')&.first) VAProfile::Models::Demographic.new( preferred_name:, gender_identity: ) end |