Class: CandidApiClient::Individual::Types::Patient
- Inherits:
-
Object
- Object
- CandidApiClient::Individual::Types::Patient
- Defined in:
- lib/candidhealth/individual/types/patient.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#address ⇒ CandidApiClient::Commons::Types::StreetAddressShortZip
readonly
Box 5 on the CMS-1500 claim form.
-
#date_of_birth ⇒ Date
readonly
Box 3 on the CMS-1500 claim form.
- #email ⇒ String readonly
- #email_consent ⇒ Boolean readonly
-
#external_id ⇒ String
readonly
The ID used to identify this individual in your system.
- #first_name ⇒ String readonly
- #gender ⇒ CandidApiClient::Individual::Types::Gender readonly
- #individual_id ⇒ String readonly
- #last_name ⇒ String readonly
- #non_insurance_payers ⇒ Array<CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer> readonly
- #non_insurance_payers_info ⇒ Array<CandidApiClient::Individual::Types::PatientNonInsurancePayerInfo> readonly
- #phone_consent ⇒ Boolean readonly
- #phone_numbers ⇒ Array<CandidApiClient::Commons::Types::PhoneNumber> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Individual::Types::Patient
Deserialize a JSON object to an instance of Patient.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(individual_id:, phone_numbers:, phone_consent:, email_consent:, non_insurance_payers:, non_insurance_payers_info:, external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, email: OMIT, additional_properties: nil) ⇒ CandidApiClient::Individual::Types::Patient constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Patient to a JSON object.
Constructor Details
#initialize(individual_id:, phone_numbers:, phone_consent:, email_consent:, non_insurance_payers:, non_insurance_payers_info:, external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, email: OMIT, additional_properties: nil) ⇒ CandidApiClient::Individual::Types::Patient
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/candidhealth/individual/types/patient.rb', line 69 def initialize(individual_id:, phone_numbers:, phone_consent:, email_consent:, non_insurance_payers:, non_insurance_payers_info:, external_id:, date_of_birth:, address:, first_name:, last_name:, gender:, email: OMIT, additional_properties: nil) @individual_id = individual_id @phone_numbers = phone_numbers @phone_consent = @email = email if email != OMIT @email_consent = @non_insurance_payers = non_insurance_payers @non_insurance_payers_info = non_insurance_payers_info @external_id = external_id @date_of_birth = date_of_birth @address = address @first_name = first_name @last_name = last_name @gender = gender @additional_properties = additional_properties @_field_set = { "individual_id": individual_id, "phone_numbers": phone_numbers, "phone_consent": , "email": email, "email_consent": , "non_insurance_payers": non_insurance_payers, "non_insurance_payers_info": non_insurance_payers_info, "external_id": external_id, "date_of_birth": date_of_birth, "address": address, "first_name": first_name, "last_name": last_name, "gender": gender }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
45 46 47 |
# File 'lib/candidhealth/individual/types/patient.rb', line 45 def additional_properties @additional_properties end |
#address ⇒ CandidApiClient::Commons::Types::StreetAddressShortZip (readonly)
Returns Box 5 on the CMS-1500 claim form.
37 38 39 |
# File 'lib/candidhealth/individual/types/patient.rb', line 37 def address @address end |
#date_of_birth ⇒ Date (readonly)
Returns Box 3 on the CMS-1500 claim form. The date format should be in ISO 8601 date; formatted YYYY-MM-DD (i.e. 2012-02-01).
35 36 37 |
# File 'lib/candidhealth/individual/types/patient.rb', line 35 def date_of_birth @date_of_birth end |
#email ⇒ String (readonly)
23 24 25 |
# File 'lib/candidhealth/individual/types/patient.rb', line 23 def email @email end |
#email_consent ⇒ Boolean (readonly)
25 26 27 |
# File 'lib/candidhealth/individual/types/patient.rb', line 25 def @email_consent end |
#external_id ⇒ String (readonly)
Returns The ID used to identify this individual in your system. For example, your internal patient ID or an EHR patient ID.
32 33 34 |
# File 'lib/candidhealth/individual/types/patient.rb', line 32 def external_id @external_id end |
#first_name ⇒ String (readonly)
39 40 41 |
# File 'lib/candidhealth/individual/types/patient.rb', line 39 def first_name @first_name end |
#gender ⇒ CandidApiClient::Individual::Types::Gender (readonly)
43 44 45 |
# File 'lib/candidhealth/individual/types/patient.rb', line 43 def gender @gender end |
#individual_id ⇒ String (readonly)
17 18 19 |
# File 'lib/candidhealth/individual/types/patient.rb', line 17 def individual_id @individual_id end |
#last_name ⇒ String (readonly)
41 42 43 |
# File 'lib/candidhealth/individual/types/patient.rb', line 41 def last_name @last_name end |
#non_insurance_payers ⇒ Array<CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer> (readonly)
27 28 29 |
# File 'lib/candidhealth/individual/types/patient.rb', line 27 def non_insurance_payers @non_insurance_payers end |
#non_insurance_payers_info ⇒ Array<CandidApiClient::Individual::Types::PatientNonInsurancePayerInfo> (readonly)
29 30 31 |
# File 'lib/candidhealth/individual/types/patient.rb', line 29 def non_insurance_payers_info @non_insurance_payers_info end |
#phone_consent ⇒ Boolean (readonly)
21 22 23 |
# File 'lib/candidhealth/individual/types/patient.rb', line 21 def @phone_consent end |
#phone_numbers ⇒ Array<CandidApiClient::Commons::Types::PhoneNumber> (readonly)
19 20 21 |
# File 'lib/candidhealth/individual/types/patient.rb', line 19 def phone_numbers @phone_numbers end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Individual::Types::Patient
Deserialize a JSON object to an instance of Patient
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/candidhealth/individual/types/patient.rb', line 108 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) individual_id = struct["individual_id"] phone_numbers = parsed_json["phone_numbers"]&.map do |item| item = item.to_json CandidApiClient::Commons::Types::PhoneNumber.from_json(json_object: item) end = struct["phone_consent"] email = struct["email"] = struct["email_consent"] non_insurance_payers = parsed_json["non_insurance_payers"]&.map do |item| item = item.to_json CandidApiClient::NonInsurancePayers::V1::Types::NonInsurancePayer.from_json(json_object: item) end non_insurance_payers_info = parsed_json["non_insurance_payers_info"]&.map do |item| item = item.to_json CandidApiClient::Individual::Types::PatientNonInsurancePayerInfo.from_json(json_object: item) end external_id = struct["external_id"] date_of_birth = (Date.parse(parsed_json["date_of_birth"]) unless parsed_json["date_of_birth"].nil?) if parsed_json["address"].nil? address = nil else address = parsed_json["address"].to_json address = CandidApiClient::Commons::Types::StreetAddressShortZip.from_json(json_object: address) end first_name = struct["first_name"] last_name = struct["last_name"] gender = struct["gender"] new( individual_id: individual_id, phone_numbers: phone_numbers, phone_consent: , email: email, email_consent: , non_insurance_payers: non_insurance_payers, non_insurance_payers_info: non_insurance_payers_info, external_id: external_id, date_of_birth: date_of_birth, address: address, first_name: first_name, last_name: last_name, gender: gender, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/candidhealth/individual/types/patient.rb', line 169 def self.validate_raw(obj:) obj.individual_id.is_a?(String) != false || raise("Passed value for field obj.individual_id is not the expected type, validation failed.") obj.phone_numbers.is_a?(Array) != false || raise("Passed value for field obj.phone_numbers is not the expected type, validation failed.") obj..is_a?(Boolean) != false || raise("Passed value for field obj.phone_consent is not the expected type, validation failed.") obj.email&.is_a?(String) != false || raise("Passed value for field obj.email is not the expected type, validation failed.") obj..is_a?(Boolean) != false || raise("Passed value for field obj.email_consent is not the expected type, validation failed.") obj.non_insurance_payers.is_a?(Array) != false || raise("Passed value for field obj.non_insurance_payers is not the expected type, validation failed.") obj.non_insurance_payers_info.is_a?(Array) != false || raise("Passed value for field obj.non_insurance_payers_info is not the expected type, validation failed.") obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") obj.date_of_birth.is_a?(Date) != false || raise("Passed value for field obj.date_of_birth is not the expected type, validation failed.") CandidApiClient::Commons::Types::StreetAddressShortZip.validate_raw(obj: obj.address) obj.first_name.is_a?(String) != false || raise("Passed value for field obj.first_name is not the expected type, validation failed.") obj.last_name.is_a?(String) != false || raise("Passed value for field obj.last_name is not the expected type, validation failed.") obj.gender.is_a?(CandidApiClient::Individual::Types::Gender) != false || raise("Passed value for field obj.gender is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Patient to a JSON object
159 160 161 |
# File 'lib/candidhealth/individual/types/patient.rb', line 159 def to_json(*_args) @_field_set&.to_json end |