Class: CandidApiClient::Encounters::V4::Types::Medication
- Inherits:
-
Object
- Object
- CandidApiClient::Encounters::V4::Types::Medication
- Defined in:
- lib/candidhealth/encounters/v_4/types/medication.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #as_needed ⇒ Boolean readonly
- #dosage ⇒ String readonly
- #dosage_form ⇒ String readonly
- #frequency ⇒ String readonly
- #name ⇒ String readonly
- #rx_cui ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::Medication
Deserialize a JSON object to an instance of Medication.
-
.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(name:, rx_cui: OMIT, dosage: OMIT, dosage_form: OMIT, frequency: OMIT, as_needed: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::Medication constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Medication to a JSON object.
Constructor Details
#initialize(name:, rx_cui: OMIT, dosage: OMIT, dosage_form: OMIT, frequency: OMIT, as_needed: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::Medication
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 39 def initialize(name:, rx_cui: OMIT, dosage: OMIT, dosage_form: OMIT, frequency: OMIT, as_needed: OMIT, additional_properties: nil) @name = name @rx_cui = rx_cui if rx_cui != OMIT @dosage = dosage if dosage != OMIT @dosage_form = dosage_form if dosage_form != OMIT @frequency = frequency if frequency != OMIT @as_needed = as_needed if as_needed != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "rx_cui": rx_cui, "dosage": dosage, "dosage_form": dosage_form, "frequency": frequency, "as_needed": as_needed }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 24 def additional_properties @additional_properties end |
#as_needed ⇒ Boolean (readonly)
22 23 24 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 22 def as_needed @as_needed end |
#dosage ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 16 def dosage @dosage end |
#dosage_form ⇒ String (readonly)
18 19 20 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 18 def dosage_form @dosage_form end |
#frequency ⇒ String (readonly)
20 21 22 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 20 def frequency @frequency end |
#name ⇒ String (readonly)
12 13 14 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 12 def name @name end |
#rx_cui ⇒ String (readonly)
14 15 16 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 14 def rx_cui @rx_cui end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::Medication
Deserialize a JSON object to an instance of Medication
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 64 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) name = struct["name"] rx_cui = struct["rx_cui"] dosage = struct["dosage"] dosage_form = struct["dosage_form"] frequency = struct["frequency"] as_needed = struct["as_needed"] new( name: name, rx_cui: rx_cui, dosage: dosage, dosage_form: dosage_form, frequency: frequency, as_needed: as_needed, 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.
96 97 98 99 100 101 102 103 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 96 def self.validate_raw(obj:) obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.rx_cui&.is_a?(String) != false || raise("Passed value for field obj.rx_cui is not the expected type, validation failed.") obj.dosage&.is_a?(String) != false || raise("Passed value for field obj.dosage is not the expected type, validation failed.") obj.dosage_form&.is_a?(String) != false || raise("Passed value for field obj.dosage_form is not the expected type, validation failed.") obj.frequency&.is_a?(String) != false || raise("Passed value for field obj.frequency is not the expected type, validation failed.") obj.as_needed&.is_a?(Boolean) != false || raise("Passed value for field obj.as_needed is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Medication to a JSON object
86 87 88 |
# File 'lib/candidhealth/encounters/v_4/types/medication.rb', line 86 def to_json(*_args) @_field_set&.to_json end |