Class: CandidApiClient::PatientPayments::V4::Types::PatientPayment

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/patient_payments/v_4/types/patient_payment.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patient_payment_id:, organization_id:, payment_source:, amount_cents:, patient_external_id:, allocations:, source_internal_id: OMIT, payment_timestamp: OMIT, payment_note: OMIT, invoice: OMIT, additional_properties: nil) ⇒ CandidApiClient::PatientPayments::V4::Types::PatientPayment

Parameters:

  • patient_payment_id (String)
  • organization_id (String)
  • source_internal_id (String) (defaults to: OMIT)
  • payment_source (CandidApiClient::Financials::Types::PatientTransactionSource)
  • amount_cents (Integer)
  • patient_external_id (String)
  • payment_timestamp (DateTime) (defaults to: OMIT)
  • payment_note (String) (defaults to: OMIT)
  • allocations (Array<CandidApiClient::Financials::Types::Allocation>)
  • invoice (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



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
81
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 54

def initialize(patient_payment_id:, organization_id:, payment_source:, amount_cents:, patient_external_id:,
               allocations:, source_internal_id: OMIT, payment_timestamp: OMIT, payment_note: OMIT, invoice: OMIT, additional_properties: nil)
  @patient_payment_id = patient_payment_id
  @organization_id = organization_id
  @source_internal_id = source_internal_id if source_internal_id != OMIT
  @payment_source = payment_source
  @amount_cents = amount_cents
  @patient_external_id = patient_external_id
  @payment_timestamp = payment_timestamp if payment_timestamp != OMIT
  @payment_note = payment_note if payment_note != OMIT
  @allocations = allocations
  @invoice = invoice if invoice != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "patient_payment_id": patient_payment_id,
    "organization_id": organization_id,
    "source_internal_id": source_internal_id,
    "payment_source": payment_source,
    "amount_cents": amount_cents,
    "patient_external_id": patient_external_id,
    "payment_timestamp": payment_timestamp,
    "payment_note": payment_note,
    "allocations": allocations,
    "invoice": invoice
  }.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



35
36
37
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 35

def additional_properties
  @additional_properties
end

#allocationsArray<CandidApiClient::Financials::Types::Allocation> (readonly)



31
32
33
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 31

def allocations
  @allocations
end

#amount_centsInteger (readonly)

Returns:

  • (Integer)


23
24
25
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 23

def amount_cents
  @amount_cents
end

#invoiceString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 33

def invoice
  @invoice
end

#organization_idString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 17

def organization_id
  @organization_id
end

#patient_external_idString (readonly)

Returns:

  • (String)


25
26
27
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 25

def patient_external_id
  @patient_external_id
end

#patient_payment_idString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 15

def patient_payment_id
  @patient_payment_id
end

#payment_noteString (readonly)

Returns:

  • (String)


29
30
31
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 29

def payment_note
  @payment_note
end

#payment_sourceCandidApiClient::Financials::Types::PatientTransactionSource (readonly)



21
22
23
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 21

def payment_source
  @payment_source
end

#payment_timestampDateTime (readonly)

Returns:

  • (DateTime)


27
28
29
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 27

def payment_timestamp
  @payment_timestamp
end

#source_internal_idString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 19

def source_internal_id
  @source_internal_id
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::PatientPayments::V4::Types::PatientPayment

Deserialize a JSON object to an instance of PatientPayment

Parameters:

  • json_object (String)

Returns:



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
115
116
117
118
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 87

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  patient_payment_id = struct["patient_payment_id"]
  organization_id = struct["organization_id"]
  source_internal_id = struct["source_internal_id"]
  payment_source = struct["payment_source"]
  amount_cents = struct["amount_cents"]
  patient_external_id = struct["patient_external_id"]
  payment_timestamp = unless parsed_json["payment_timestamp"].nil?
                        DateTime.parse(parsed_json["payment_timestamp"])
                      end
  payment_note = struct["payment_note"]
  allocations = parsed_json["allocations"]&.map do |item|
    item = item.to_json
    CandidApiClient::Financials::Types::Allocation.from_json(json_object: item)
  end
  invoice = struct["invoice"]
  new(
    patient_payment_id: patient_payment_id,
    organization_id: organization_id,
    source_internal_id: source_internal_id,
    payment_source: payment_source,
    amount_cents: amount_cents,
    patient_external_id: patient_external_id,
    payment_timestamp: payment_timestamp,
    payment_note: payment_note,
    allocations: allocations,
    invoice: invoice,
    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)


133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 133

def self.validate_raw(obj:)
  obj.patient_payment_id.is_a?(String) != false || raise("Passed value for field obj.patient_payment_id is not the expected type, validation failed.")
  obj.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_id is not the expected type, validation failed.")
  obj.source_internal_id&.is_a?(String) != false || raise("Passed value for field obj.source_internal_id is not the expected type, validation failed.")
  obj.payment_source.is_a?(CandidApiClient::Financials::Types::PatientTransactionSource) != false || raise("Passed value for field obj.payment_source 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.")
  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.payment_timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.payment_timestamp is not the expected type, validation failed.")
  obj.payment_note&.is_a?(String) != false || raise("Passed value for field obj.payment_note is not the expected type, validation failed.")
  obj.allocations.is_a?(Array) != false || raise("Passed value for field obj.allocations is not the expected type, validation failed.")
  obj.invoice&.is_a?(String) != false || raise("Passed value for field obj.invoice is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of PatientPayment to a JSON object

Returns:

  • (String)


123
124
125
# File 'lib/candidhealth/patient_payments/v_4/types/patient_payment.rb', line 123

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