Class: CandidApiClient::Encounters::V4::Types::ClinicalNote

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:, author_name:, timestamp:, author_npi: OMIT, additional_properties: nil) ⇒ CandidApiClient::Encounters::V4::Types::ClinicalNote

Parameters:

  • text (String)
  • author_name (String)
  • author_npi (String) (defaults to: OMIT)
  • timestamp (DateTime)
  • 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
47
48
# File 'lib/candidhealth/encounters/v_4/types/clinical_note.rb', line 34

def initialize(text:, author_name:, timestamp:, author_npi: OMIT, additional_properties: nil)
  @text = text
  @author_name = author_name
  @author_npi = author_npi if author_npi != OMIT
  @timestamp = timestamp
  @additional_properties = additional_properties
  @_field_set = {
    "text": text,
    "author_name": author_name,
    "author_npi": author_npi,
    "timestamp": timestamp
  }.reject do |_k, v|
    v == OMIT
  end
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/clinical_note.rb', line 21

def additional_properties
  @additional_properties
end

#author_nameString (readonly)

Returns:

  • (String)


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

def author_name
  @author_name
end

#author_npiString (readonly)

Returns:

  • (String)


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

def author_npi
  @author_npi
end

#textString (readonly)

Returns:

  • (String)


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

def text
  @text
end

#timestampDateTime (readonly)

Returns:

  • (DateTime)


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

def timestamp
  @timestamp
end

Class Method Details

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

Deserialize a JSON object to an instance of ClinicalNote

Parameters:

  • json_object (String)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/candidhealth/encounters/v_4/types/clinical_note.rb', line 54

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  text = struct["text"]
  author_name = struct["author_name"]
  author_npi = struct["author_npi"]
  timestamp = (DateTime.parse(parsed_json["timestamp"]) unless parsed_json["timestamp"].nil?)
  new(
    text: text,
    author_name: author_name,
    author_npi: author_npi,
    timestamp: timestamp,
    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)


83
84
85
86
87
88
# File 'lib/candidhealth/encounters/v_4/types/clinical_note.rb', line 83

def self.validate_raw(obj:)
  obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
  obj.author_name.is_a?(String) != false || raise("Passed value for field obj.author_name is not the expected type, validation failed.")
  obj.author_npi&.is_a?(String) != false || raise("Passed value for field obj.author_npi is not the expected type, validation failed.")
  obj.timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ClinicalNote to a JSON object

Returns:

  • (String)


73
74
75
# File 'lib/candidhealth/encounters/v_4/types/clinical_note.rb', line 73

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