Class: CandidApiClient::Individual::Types::PatientUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/individual/types/patient_update.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name: OMIT, last_name: OMIT, gender: OMIT, external_id: OMIT, date_of_birth: OMIT, address: OMIT, phone_numbers: OMIT, phone_consent: OMIT, email: OMIT, email_consent: OMIT, non_insurance_payers: OMIT, non_insurance_payers_info: OMIT, additional_properties: nil) ⇒ CandidApiClient::Individual::Types::PatientUpdate

Parameters:

  • first_name (String) (defaults to: OMIT)
  • last_name (String) (defaults to: OMIT)
  • gender (CandidApiClient::Individual::Types::Gender) (defaults to: OMIT)
  • external_id (String) (defaults to: OMIT)

    The ID used to identify this individual in your system. For example, your internal patient ID or an EHR patient ID.

  • date_of_birth (Date) (defaults to: OMIT)

    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)

  • address (CandidApiClient::Commons::Types::StreetAddressShortZip) (defaults to: OMIT)

    Box 5 on the CMS-1500 claim form.

  • phone_numbers (Array<CandidApiClient::Commons::Types::PhoneNumber>) (defaults to: OMIT)
  • phone_consent (Boolean) (defaults to: OMIT)
  • email (String) (defaults to: OMIT)
  • email_consent (Boolean) (defaults to: OMIT)
  • non_insurance_payers (Array<String>) (defaults to: OMIT)

    On update, we will replace the existing list of non-insurance payers with the new list if populated.

  • non_insurance_payers_info (Array<CandidApiClient::Individual::Types::PatientNonInsurancePayerInfoCreate>) (defaults to: OMIT)

    On update, we will replace the existing list of non-insurance payers with the new list if populated.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
# File 'lib/candidhealth/individual/types/patient_update.rb', line 69

def initialize(first_name: OMIT, last_name: OMIT, gender: OMIT, external_id: OMIT, date_of_birth: OMIT,
               address: OMIT, phone_numbers: OMIT, phone_consent: OMIT, email: OMIT, email_consent: OMIT, non_insurance_payers: OMIT, non_insurance_payers_info: OMIT, additional_properties: nil)
  @first_name = first_name if first_name != OMIT
  @last_name = last_name if last_name != OMIT
  @gender = gender if gender != OMIT
  @external_id = external_id if external_id != OMIT
  @date_of_birth = date_of_birth if date_of_birth != OMIT
  @address = address if address != OMIT
  @phone_numbers = phone_numbers if phone_numbers != OMIT
  @phone_consent = phone_consent if phone_consent != OMIT
  @email = email if email != OMIT
  @email_consent = email_consent if email_consent != OMIT
  @non_insurance_payers = non_insurance_payers if non_insurance_payers != OMIT
  @non_insurance_payers_info = non_insurance_payers_info if non_insurance_payers_info != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "first_name": first_name,
    "last_name": last_name,
    "gender": gender,
    "external_id": external_id,
    "date_of_birth": date_of_birth,
    "address": address,
    "phone_numbers": phone_numbers,
    "phone_consent": phone_consent,
    "email": email,
    "email_consent": email_consent,
    "non_insurance_payers": non_insurance_payers,
    "non_insurance_payers_info": non_insurance_payers_info
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



44
45
46
# File 'lib/candidhealth/individual/types/patient_update.rb', line 44

def additional_properties
  @additional_properties
end

#addressCandidApiClient::Commons::Types::StreetAddressShortZip (readonly)

Returns Box 5 on the CMS-1500 claim form.

Returns:



28
29
30
# File 'lib/candidhealth/individual/types/patient_update.rb', line 28

def address
  @address
end

#date_of_birthDate (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).

Returns:

  • (Date)

    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)



26
27
28
# File 'lib/candidhealth/individual/types/patient_update.rb', line 26

def date_of_birth
  @date_of_birth
end

#emailString (readonly)

Returns:

  • (String)


34
35
36
# File 'lib/candidhealth/individual/types/patient_update.rb', line 34

def email
  @email
end

Returns:

  • (Boolean)


36
37
38
# File 'lib/candidhealth/individual/types/patient_update.rb', line 36

def email_consent
  @email_consent
end

#external_idString (readonly)

Returns The ID used to identify this individual in your system. For example, your internal patient ID or an EHR patient ID.

Returns:

  • (String)

    The ID used to identify this individual in your system. For example, your internal patient ID or an EHR patient ID.



23
24
25
# File 'lib/candidhealth/individual/types/patient_update.rb', line 23

def external_id
  @external_id
end

#first_nameString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/individual/types/patient_update.rb', line 16

def first_name
  @first_name
end

#genderCandidApiClient::Individual::Types::Gender (readonly)



20
21
22
# File 'lib/candidhealth/individual/types/patient_update.rb', line 20

def gender
  @gender
end

#last_nameString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/individual/types/patient_update.rb', line 18

def last_name
  @last_name
end

#non_insurance_payersArray<String> (readonly)

Returns On update, we will replace the existing list of non-insurance payers with the new list if populated.

Returns:

  • (Array<String>)

    On update, we will replace the existing list of non-insurance payers with the new list if populated.



39
40
41
# File 'lib/candidhealth/individual/types/patient_update.rb', line 39

def non_insurance_payers
  @non_insurance_payers
end

#non_insurance_payers_infoArray<CandidApiClient::Individual::Types::PatientNonInsurancePayerInfoCreate> (readonly)

Returns On update, we will replace the existing list of non-insurance payers with the new list if populated.

Returns:



42
43
44
# File 'lib/candidhealth/individual/types/patient_update.rb', line 42

def non_insurance_payers_info
  @non_insurance_payers_info
end

Returns:

  • (Boolean)


32
33
34
# File 'lib/candidhealth/individual/types/patient_update.rb', line 32

def phone_consent
  @phone_consent
end

#phone_numbersArray<CandidApiClient::Commons::Types::PhoneNumber> (readonly)



30
31
32
# File 'lib/candidhealth/individual/types/patient_update.rb', line 30

def phone_numbers
  @phone_numbers
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Individual::Types::PatientUpdate

Deserialize a JSON object to an instance of PatientUpdate

Parameters:

  • json_object (String)

Returns:



106
107
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
# File 'lib/candidhealth/individual/types/patient_update.rb', line 106

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  first_name = struct["first_name"]
  last_name = struct["last_name"]
  gender = struct["gender"]
  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
  phone_numbers = parsed_json["phone_numbers"]&.map do |item|
    item = item.to_json
    CandidApiClient::Commons::Types::PhoneNumber.from_json(json_object: item)
  end
  phone_consent = struct["phone_consent"]
  email = struct["email"]
  email_consent = struct["email_consent"]
  non_insurance_payers = struct["non_insurance_payers"]
  non_insurance_payers_info = parsed_json["non_insurance_payers_info"]&.map do |item|
    item = item.to_json
    CandidApiClient::Individual::Types::PatientNonInsurancePayerInfoCreate.from_json(json_object: item)
  end
  new(
    first_name: first_name,
    last_name: last_name,
    gender: gender,
    external_id: external_id,
    date_of_birth: date_of_birth,
    address: address,
    phone_numbers: phone_numbers,
    phone_consent: phone_consent,
    email: email,
    email_consent: email_consent,
    non_insurance_payers: non_insurance_payers,
    non_insurance_payers_info: non_insurance_payers_info,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/candidhealth/individual/types/patient_update.rb', line 162

def self.validate_raw(obj:)
  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.")
  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.")
  obj.address.nil? || CandidApiClient::Commons::Types::StreetAddressShortZip.validate_raw(obj: obj.address)
  obj.phone_numbers&.is_a?(Array) != false || raise("Passed value for field obj.phone_numbers is not the expected type, validation failed.")
  obj.phone_consent&.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.email_consent&.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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PatientUpdate to a JSON object

Returns:

  • (String)


152
153
154
# File 'lib/candidhealth/individual/types/patient_update.rb', line 152

def to_json(*_args)
  @_field_set&.to_json
end