Class: CandidApiClient::ServiceLines::V2::Types::TestResult
- Inherits:
-
Object
- Object
- CandidApiClient::ServiceLines::V2::Types::TestResult
- Defined in:
- lib/candidhealth/service_lines/v_2/types/test_result.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #result_type ⇒ CandidApiClient::ServiceLines::V2::Types::TestResultType readonly
- #value ⇒ Float readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::ServiceLines::V2::Types::TestResult
Deserialize a JSON object to an instance of TestResult.
-
.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(value:, result_type:, additional_properties: nil) ⇒ CandidApiClient::ServiceLines::V2::Types::TestResult constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TestResult to a JSON object.
Constructor Details
#initialize(value:, result_type:, additional_properties: nil) ⇒ CandidApiClient::ServiceLines::V2::Types::TestResult
28 29 30 31 32 33 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 28 def initialize(value:, result_type:, additional_properties: nil) @value = value @result_type = result_type @additional_properties = additional_properties @_field_set = { "value": value, "result_type": result_type } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 17 def additional_properties @additional_properties end |
#result_type ⇒ CandidApiClient::ServiceLines::V2::Types::TestResultType (readonly)
15 16 17 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 15 def result_type @result_type end |
#value ⇒ Float (readonly)
13 14 15 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 13 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::ServiceLines::V2::Types::TestResult
Deserialize a JSON object to an instance of TestResult
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) value = struct["value"] result_type = struct["result_type"] new( value: value, result_type: result_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.
63 64 65 66 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 63 def self.validate_raw(obj:) obj.value.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.result_type.is_a?(CandidApiClient::ServiceLines::V2::Types::TestResultType) != false || raise("Passed value for field obj.result_type is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TestResult to a JSON object
53 54 55 |
# File 'lib/candidhealth/service_lines/v_2/types/test_result.rb', line 53 def to_json(*_args) @_field_set&.to_json end |