Class: CandidApiClient::Encounters::V4::Types::Lab
- Inherits:
-
Object
- Object
- CandidApiClient::Encounters::V4::Types::Lab
- Defined in:
- lib/candidhealth/encounters/v_4/types/lab.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #code ⇒ String readonly
- #code_type ⇒ CandidApiClient::Encounters::V4::Types::LabCodeType readonly
- #name ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::Lab
Deserialize a JSON object to an instance of Lab.
-
.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:, code: OMIT, code_type: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::Lab constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Lab to a JSON object.
Constructor Details
#initialize(name:, code: OMIT, code_type: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::Lab
31 32 33 34 35 36 37 38 39 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 31 def initialize(name:, code: OMIT, code_type: OMIT, additional_properties: nil) @name = name @code = code if code != OMIT @code_type = code_type if code_type != OMIT @additional_properties = additional_properties @_field_set = { "name": name, "code": code, "code_type": code_type }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 19 def additional_properties @additional_properties end |
#code ⇒ String (readonly)
15 16 17 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 15 def code @code end |
#code_type ⇒ CandidApiClient::Encounters::V4::Types::LabCodeType (readonly)
17 18 19 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 17 def code_type @code_type end |
#name ⇒ String (readonly)
13 14 15 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 13 def name @name end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::Lab
Deserialize a JSON object to an instance of Lab
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) name = struct["name"] code = struct["code"] code_type = struct["code_type"] new( name: name, code: code, code_type: code_type, 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.
71 72 73 74 75 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 71 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.code&.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.") obj.code_type&.is_a?(CandidApiClient::Encounters::V4::Types::LabCodeType) != false || raise("Passed value for field obj.code_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Lab to a JSON object
61 62 63 |
# File 'lib/candidhealth/encounters/v_4/types/lab.rb', line 61 def to_json(*_args) @_field_set&.to_json end |