Class: CandidApiClient::PreEncounter::Common::Types::VersionConflictErrorBody

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, latest_version:, message:, additional_properties: nil) ⇒ CandidApiClient::PreEncounter::Common::Types::VersionConflictErrorBody

Parameters:

  • code (String)
  • latest_version (Integer)
  • message (String)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



30
31
32
33
34
35
36
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 30

def initialize(code:, latest_version:, message:, additional_properties: nil)
  @code = code
  @latest_version = latest_version
  @message = message
  @additional_properties = additional_properties
  @_field_set = { "code": code, "latest_version": latest_version, "message": message }
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



18
19
20
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 18

def additional_properties
  @additional_properties
end

#codeString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 12

def code
  @code
end

#latest_versionInteger (readonly)

Returns:

  • (Integer)


14
15
16
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 14

def latest_version
  @latest_version
end

#messageString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 16

def message
  @message
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::PreEncounter::Common::Types::VersionConflictErrorBody

Deserialize a JSON object to an instance of VersionConflictErrorBody



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 42

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  code = struct["code"]
  latest_version = struct["latest_version"]
  message = struct["message"]
  new(
    code: code,
    latest_version: latest_version,
    message: message,
    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)


68
69
70
71
72
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 68

def self.validate_raw(obj:)
  obj.code.is_a?(String) != false || raise("Passed value for field obj.code is not the expected type, validation failed.")
  obj.latest_version.is_a?(Integer) != false || raise("Passed value for field obj.latest_version is not the expected type, validation failed.")
  obj.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of VersionConflictErrorBody to a JSON object

Returns:

  • (String)


58
59
60
# File 'lib/candidhealth/pre_encounter/common/types/version_conflict_error_body.rb', line 58

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