Class: VAProfile::Models::GenderIdentity
- Includes:
- Concerns::Defaultable
- Defined in:
- lib/va_profile/models/gender_identity.rb
Constant Summary collapse
- CODES =
%w[M F TM TF B N O].freeze
- OPTIONS =
{ 'M' => 'Man', 'B' => 'Non-binary', 'TM' => 'Transgender man', 'TF' => 'Transgender woman', 'F' => 'Woman', 'N' => 'Prefer not to answer', 'O' => 'A gender not listed here' }.freeze
Constants inherited from Base
Class Method Summary collapse
-
.build_from(body) ⇒ VAProfile::Models::GenderIdentity
Converts a decoded JSON response from VAProfile to an instance of the GenderIdentity model.
Instance Method Summary collapse
- #code=(val) ⇒ Object
-
#in_json ⇒ String
Converts an instance of the GenderIdentity model to a JSON encoded string suitable for use in the body of a request to VAProfile.
Methods included from Concerns::Defaultable
Class Method Details
.build_from(body) ⇒ VAProfile::Models::GenderIdentity
Converts a decoded JSON response from VAProfile to an instance of the GenderIdentity model
56 57 58 59 60 61 62 63 |
# File 'lib/va_profile/models/gender_identity.rb', line 56 def self.build_from(body) return nil unless body VAProfile::Models::GenderIdentity.new( code: body['gender_identity_code'], name: body['gender_identity_name'] ) end |
Instance Method Details
#code=(val) ⇒ Object
31 32 33 34 |
# File 'lib/va_profile/models/gender_identity.rb', line 31 def code=(val) @code = val @name = OPTIONS[@code] end |
#in_json ⇒ String
Converts an instance of the GenderIdentity model to a JSON encoded string suitable for use in the body of a request to VAProfile
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/va_profile/models/gender_identity.rb', line 40 def in_json { bio: { genderIdentity: [ genderIdentityCode: @code ], sourceDate: @source_date, originatingSourceSystem: SOURCE_SYSTEM, sourceSystemUser: @source_system_user } }.to_json end |