Class: CandidApiClient::WriteOffs::V1::Types::PatientWriteOff

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/write_offs/v_1/types/patient_write_off.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(write_off_id:, write_off_timestamp:, write_off_reason:, patient_external_id:, claim_id:, service_line_id:, amount_cents:, write_off_note: OMIT, reverts_write_off_id: OMIT, reverted_by_write_off_id: OMIT, additional_properties: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::PatientWriteOff

Parameters:

  • write_off_id (String)
  • write_off_timestamp (DateTime)
  • write_off_note (String) (defaults to: OMIT)
  • write_off_reason (CandidApiClient::WriteOffs::V1::Types::PatientWriteOffReason)
  • patient_external_id (String)
  • claim_id (String)
  • service_line_id (String)
  • reverts_write_off_id (String) (defaults to: OMIT)
  • reverted_by_write_off_id (String) (defaults to: OMIT)
  • amount_cents (Integer)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 53

def initialize(write_off_id:, write_off_timestamp:, write_off_reason:, patient_external_id:, claim_id:,
               service_line_id:, amount_cents:, write_off_note: OMIT, reverts_write_off_id: OMIT, reverted_by_write_off_id: OMIT, additional_properties: nil)
  @write_off_id = write_off_id
  @write_off_timestamp = write_off_timestamp
  @write_off_note = write_off_note if write_off_note != OMIT
  @write_off_reason = write_off_reason
  @patient_external_id = patient_external_id
  @claim_id = claim_id
  @service_line_id = service_line_id
  @reverts_write_off_id = reverts_write_off_id if reverts_write_off_id != OMIT
  @reverted_by_write_off_id = reverted_by_write_off_id if reverted_by_write_off_id != OMIT
  @amount_cents = amount_cents
  @additional_properties = additional_properties
  @_field_set = {
    "write_off_id": write_off_id,
    "write_off_timestamp": write_off_timestamp,
    "write_off_note": write_off_note,
    "write_off_reason": write_off_reason,
    "patient_external_id": patient_external_id,
    "claim_id": claim_id,
    "service_line_id": service_line_id,
    "reverts_write_off_id": reverts_write_off_id,
    "reverted_by_write_off_id": reverted_by_write_off_id,
    "amount_cents": amount_cents
  }.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



34
35
36
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 34

def additional_properties
  @additional_properties
end

#amount_centsInteger (readonly)

Returns:

  • (Integer)


32
33
34
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 32

def amount_cents
  @amount_cents
end

#claim_idString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 24

def claim_id
  @claim_id
end

#patient_external_idString (readonly)

Returns:

  • (String)


22
23
24
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 22

def patient_external_id
  @patient_external_id
end

#reverted_by_write_off_idString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 30

def reverted_by_write_off_id
  @reverted_by_write_off_id
end

#reverts_write_off_idString (readonly)

Returns:

  • (String)


28
29
30
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 28

def reverts_write_off_id
  @reverts_write_off_id
end

#service_line_idString (readonly)

Returns:

  • (String)


26
27
28
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 26

def service_line_id
  @service_line_id
end

#write_off_idString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 14

def write_off_id
  @write_off_id
end

#write_off_noteString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 18

def write_off_note
  @write_off_note
end

#write_off_reasonCandidApiClient::WriteOffs::V1::Types::PatientWriteOffReason (readonly)



20
21
22
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 20

def write_off_reason
  @write_off_reason
end

#write_off_timestampDateTime (readonly)

Returns:

  • (DateTime)


16
17
18
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 16

def write_off_timestamp
  @write_off_timestamp
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::WriteOffs::V1::Types::PatientWriteOff

Deserialize a JSON object to an instance of PatientWriteOff

Parameters:

  • json_object (String)

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 86

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  write_off_id = struct["write_off_id"]
  write_off_timestamp = unless parsed_json["write_off_timestamp"].nil?
                          DateTime.parse(parsed_json["write_off_timestamp"])
                        end
  write_off_note = struct["write_off_note"]
  write_off_reason = struct["write_off_reason"]
  patient_external_id = struct["patient_external_id"]
  claim_id = struct["claim_id"]
  service_line_id = struct["service_line_id"]
  reverts_write_off_id = struct["reverts_write_off_id"]
  reverted_by_write_off_id = struct["reverted_by_write_off_id"]
  amount_cents = struct["amount_cents"]
  new(
    write_off_id: write_off_id,
    write_off_timestamp: write_off_timestamp,
    write_off_note: write_off_note,
    write_off_reason: write_off_reason,
    patient_external_id: patient_external_id,
    claim_id: claim_id,
    service_line_id: service_line_id,
    reverts_write_off_id: reverts_write_off_id,
    reverted_by_write_off_id: reverted_by_write_off_id,
    amount_cents: amount_cents,
    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)


129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 129

def self.validate_raw(obj:)
  obj.write_off_id.is_a?(String) != false || raise("Passed value for field obj.write_off_id is not the expected type, validation failed.")
  obj.write_off_timestamp.is_a?(DateTime) != false || raise("Passed value for field obj.write_off_timestamp is not the expected type, validation failed.")
  obj.write_off_note&.is_a?(String) != false || raise("Passed value for field obj.write_off_note is not the expected type, validation failed.")
  obj.write_off_reason.is_a?(CandidApiClient::WriteOffs::V1::Types::PatientWriteOffReason) != false || raise("Passed value for field obj.write_off_reason is not the expected type, validation failed.")
  obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.")
  obj.claim_id.is_a?(String) != false || raise("Passed value for field obj.claim_id is not the expected type, validation failed.")
  obj.service_line_id.is_a?(String) != false || raise("Passed value for field obj.service_line_id is not the expected type, validation failed.")
  obj.reverts_write_off_id&.is_a?(String) != false || raise("Passed value for field obj.reverts_write_off_id is not the expected type, validation failed.")
  obj.reverted_by_write_off_id&.is_a?(String) != false || raise("Passed value for field obj.reverted_by_write_off_id is not the expected type, validation failed.")
  obj.amount_cents.is_a?(Integer) != false || raise("Passed value for field obj.amount_cents is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PatientWriteOff to a JSON object

Returns:

  • (String)


119
120
121
# File 'lib/candidhealth/write_offs/v_1/types/patient_write_off.rb', line 119

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