Class: CandidApiClient::Encounters::V4::Types::ValueDoesNotMatchKeyTypeError

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_id:, key:, expected_value_type:, value:, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::ValueDoesNotMatchKeyTypeError

Parameters:

  • schema_id (String)
  • key (String)
  • expected_value_type (CandidApiClient::Commons::Types::Primitive)
  • value (Object)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 34

def initialize(schema_id:, key:, expected_value_type:, value:, additional_properties: nil)
  @schema_id = schema_id
  @key = key
  @expected_value_type = expected_value_type
  @value = value
  @additional_properties = additional_properties
  @_field_set = {
    "schema_id": schema_id,
    "key": key,
    "expected_value_type": expected_value_type,
    "value": value
  }
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



21
22
23
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 21

def additional_properties
  @additional_properties
end

#expected_value_typeCandidApiClient::Commons::Types::Primitive (readonly)



17
18
19
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 17

def expected_value_type
  @expected_value_type
end

#keyString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 15

def key
  @key
end

#schema_idString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 13

def schema_id
  @schema_id
end

#valueObject (readonly)

Returns:

  • (Object)


19
20
21
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 19

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Encounters::V4::Types::ValueDoesNotMatchKeyTypeError

Deserialize a JSON object to an instance of ValueDoesNotMatchKeyTypeError

Parameters:

  • json_object (String)

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 52

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  schema_id = struct["schema_id"]
  key = struct["key"]
  expected_value_type = struct["expected_value_type"]
  value = struct["value"]
  new(
    schema_id: schema_id,
    key: key,
    expected_value_type: expected_value_type,
    value: value,
    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)


80
81
82
83
84
85
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 80

def self.validate_raw(obj:)
  obj.schema_id.is_a?(String) != false || raise("Passed value for field obj.schema_id is not the expected type, validation failed.")
  obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
  obj.expected_value_type.is_a?(CandidApiClient::Commons::Types::Primitive) != false || raise("Passed value for field obj.expected_value_type is not the expected type, validation failed.")
  obj.value.is_a?(Object) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ValueDoesNotMatchKeyTypeError to a JSON object

Returns:

  • (String)


70
71
72
# File 'lib/candidhealth/encounters/v_4/types/value_does_not_match_key_type_error.rb', line 70

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