Class: CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate
- Inherits:
-
Object
- Object
- CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate
- Defined in:
- lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #date_of_service ⇒ Date readonly
- #description ⇒ String readonly
- #drug_identification ⇒ CandidApiClient::ServiceLines::V2::Types::DrugIdentification readonly
- #medication_dispense_external_id ⇒ String readonly
- #modifiers ⇒ Array<CandidApiClient::Commons::Types::ProcedureModifier> readonly
- #patient_external_id ⇒ String readonly
- #procedure_code ⇒ String readonly
- #quantity ⇒ String readonly
- #units ⇒ CandidApiClient::Commons::Types::ServiceLineUnits readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate
Deserialize a JSON object to an instance of MedicationDispenseCreate.
-
.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(medication_dispense_external_id:, patient_external_id:, procedure_code:, quantity:, units:, date_of_service:, drug_identification: OMIT, description: OMIT, modifiers: OMIT, additional_properties: nil) ⇒ CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of MedicationDispenseCreate to a JSON object.
Constructor Details
#initialize(medication_dispense_external_id:, patient_external_id:, procedure_code:, quantity:, units:, date_of_service:, drug_identification: OMIT, description: OMIT, modifiers: OMIT, additional_properties: nil) ⇒ CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 52 def initialize(medication_dispense_external_id:, patient_external_id:, procedure_code:, quantity:, units:, date_of_service:, drug_identification: OMIT, description: OMIT, modifiers: OMIT, additional_properties: nil) @medication_dispense_external_id = medication_dispense_external_id @patient_external_id = patient_external_id @procedure_code = procedure_code @quantity = quantity @units = units @date_of_service = date_of_service @drug_identification = drug_identification if drug_identification != OMIT @description = description if description != OMIT @modifiers = modifiers if modifiers != OMIT @additional_properties = additional_properties @_field_set = { "medication_dispense_external_id": medication_dispense_external_id, "patient_external_id": patient_external_id, "procedure_code": procedure_code, "quantity": quantity, "units": units, "date_of_service": date_of_service, "drug_identification": drug_identification, "description": description, "modifiers": modifiers }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
34 35 36 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 34 def additional_properties @additional_properties end |
#date_of_service ⇒ Date (readonly)
26 27 28 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 26 def date_of_service @date_of_service end |
#description ⇒ String (readonly)
30 31 32 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 30 def description @description end |
#drug_identification ⇒ CandidApiClient::ServiceLines::V2::Types::DrugIdentification (readonly)
28 29 30 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 28 def drug_identification @drug_identification end |
#medication_dispense_external_id ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 16 def medication_dispense_external_id @medication_dispense_external_id end |
#modifiers ⇒ Array<CandidApiClient::Commons::Types::ProcedureModifier> (readonly)
32 33 34 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 32 def modifiers @modifiers end |
#patient_external_id ⇒ String (readonly)
18 19 20 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 18 def patient_external_id @patient_external_id end |
#procedure_code ⇒ String (readonly)
20 21 22 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 20 def procedure_code @procedure_code end |
#quantity ⇒ String (readonly)
22 23 24 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 22 def quantity @quantity end |
#units ⇒ CandidApiClient::Commons::Types::ServiceLineUnits (readonly)
24 25 26 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 24 def units @units end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::MedicationDispense::V1::Types::MedicationDispenseCreate
Deserialize a JSON object to an instance of MedicationDispenseCreate
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 83 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) medication_dispense_external_id = struct["medication_dispense_external_id"] patient_external_id = struct["patient_external_id"] procedure_code = struct["procedure_code"] quantity = struct["quantity"] units = struct["units"] date_of_service = (Date.parse(parsed_json["date_of_service"]) unless parsed_json["date_of_service"].nil?) if parsed_json["drug_identification"].nil? drug_identification = nil else drug_identification = parsed_json["drug_identification"].to_json drug_identification = CandidApiClient::ServiceLines::V2::Types::DrugIdentification.from_json(json_object: drug_identification) end description = struct["description"] modifiers = struct["modifiers"] new( medication_dispense_external_id: medication_dispense_external_id, patient_external_id: patient_external_id, procedure_code: procedure_code, quantity: quantity, units: units, date_of_service: date_of_service, drug_identification: drug_identification, description: description, modifiers: modifiers, 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.
127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 127 def self.validate_raw(obj:) obj.medication_dispense_external_id.is_a?(String) != false || raise("Passed value for field obj.medication_dispense_external_id is not the expected type, validation failed.") obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.") obj.procedure_code.is_a?(String) != false || raise("Passed value for field obj.procedure_code is not the expected type, validation failed.") obj.quantity.is_a?(String) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.") obj.units.is_a?(CandidApiClient::Commons::Types::ServiceLineUnits) != false || raise("Passed value for field obj.units is not the expected type, validation failed.") obj.date_of_service.is_a?(Date) != false || raise("Passed value for field obj.date_of_service is not the expected type, validation failed.") obj.drug_identification.nil? || CandidApiClient::ServiceLines::V2::Types::DrugIdentification.validate_raw(obj: obj.drug_identification) obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.modifiers&.is_a?(Array) != false || raise("Passed value for field obj.modifiers is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of MedicationDispenseCreate to a JSON object
117 118 119 |
# File 'lib/candidhealth/medication_dispense/v_1/types/medication_dispense_create.rb', line 117 def to_json(*_args) @_field_set&.to_json end |