Class: VAProfile::Models::PreferredName
- Includes:
- ActiveModel::Validations::Callbacks, Concerns::Defaultable
- Defined in:
- lib/va_profile/models/preferred_name.rb
Constant Summary
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::PreferredName
Converts a decoded JSON response from VAProfile to an instance of the PreferredName model.
Instance Method Summary collapse
-
#in_json ⇒ String
Converts an instance of the PreferredName model to a JSON encoded string suitable for use in the body of a request to VAProfile.
- #strip_blanks ⇒ Object protected
Methods included from Concerns::Defaultable
Class Method Details
.build_from(body) ⇒ VAProfile::Models::PreferredName
Converts a decoded JSON response from VAProfile to an instance of the PreferredName model
44 45 46 47 48 49 50 |
# File 'lib/va_profile/models/preferred_name.rb', line 44 def self.build_from(body) return nil unless body VAProfile::Models::PreferredName.new( text: body['preferred_name'] ) end |
Instance Method Details
#in_json ⇒ String
Converts an instance of the PreferredName model to a JSON encoded string suitable for use in the body of a request to VAProfile
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/va_profile/models/preferred_name.rb', line 30 def in_json { bio: { preferredName: @text, originatingSourceSystem: SOURCE_SYSTEM, sourceDate: @source_date, sourceSystemUser: @source_system_user } }.to_json end |
#strip_blanks ⇒ Object (protected)
54 55 56 |
# File 'lib/va_profile/models/preferred_name.rb', line 54 def strip_blanks self.text = text.strip if text end |