Class: CandidApiClient::PatientRefunds::V1::Types::PatientRefund
- Inherits:
-
Object
- Object
- CandidApiClient::PatientRefunds::V1::Types::PatientRefund
- Defined in:
- lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #allocations ⇒ Array<CandidApiClient::Financials::Types::Allocation> readonly
- #amount_cents ⇒ Integer readonly
- #invoice ⇒ String readonly
- #organization_id ⇒ String readonly
- #patient_external_id ⇒ String readonly
- #patient_refund_id ⇒ String readonly
- #refund_note ⇒ String readonly
- #refund_reason ⇒ CandidApiClient::Financials::Types::RefundReason readonly
- #refund_source ⇒ CandidApiClient::Financials::Types::PatientTransactionSource readonly
- #refund_timestamp ⇒ DateTime readonly
- #source_internal_id ⇒ String readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ CandidApiClient::PatientRefunds::V1::Types::PatientRefund
Deserialize a JSON object to an instance of PatientRefund.
-
.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.
Instance Method Summary collapse
- #initialize(patient_refund_id:, organization_id:, refund_source:, amount_cents:, patient_external_id:, allocations:, source_internal_id: OMIT, refund_timestamp: OMIT, refund_note: OMIT, invoice: OMIT, refund_reason: OMIT, additional_properties: nil) ⇒ CandidApiClient::PatientRefunds::V1::Types::PatientRefund constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PatientRefund to a JSON object.
Constructor Details
#initialize(patient_refund_id:, organization_id:, refund_source:, amount_cents:, patient_external_id:, allocations:, source_internal_id: OMIT, refund_timestamp: OMIT, refund_note: OMIT, invoice: OMIT, refund_reason: OMIT, additional_properties: nil) ⇒ CandidApiClient::PatientRefunds::V1::Types::PatientRefund
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 58 def initialize(patient_refund_id:, organization_id:, refund_source:, amount_cents:, patient_external_id:, allocations:, source_internal_id: OMIT, refund_timestamp: OMIT, refund_note: OMIT, invoice: OMIT, refund_reason: OMIT, additional_properties: nil) @patient_refund_id = patient_refund_id @organization_id = organization_id @source_internal_id = source_internal_id if source_internal_id != OMIT @refund_source = refund_source @amount_cents = amount_cents @patient_external_id = patient_external_id @refund_timestamp = if != OMIT @refund_note = refund_note if refund_note != OMIT @allocations = allocations @invoice = invoice if invoice != OMIT @refund_reason = refund_reason if refund_reason != OMIT @additional_properties = additional_properties @_field_set = { "patient_refund_id": patient_refund_id, "organization_id": organization_id, "source_internal_id": source_internal_id, "refund_source": refund_source, "amount_cents": amount_cents, "patient_external_id": patient_external_id, "refund_timestamp": , "refund_note": refund_note, "allocations": allocations, "invoice": invoice, "refund_reason": refund_reason }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
38 39 40 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 38 def additional_properties @additional_properties end |
#allocations ⇒ Array<CandidApiClient::Financials::Types::Allocation> (readonly)
32 33 34 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 32 def allocations @allocations end |
#amount_cents ⇒ Integer (readonly)
24 25 26 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 24 def amount_cents @amount_cents end |
#invoice ⇒ String (readonly)
34 35 36 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 34 def invoice @invoice end |
#organization_id ⇒ String (readonly)
18 19 20 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 18 def organization_id @organization_id end |
#patient_external_id ⇒ String (readonly)
26 27 28 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 26 def patient_external_id @patient_external_id end |
#patient_refund_id ⇒ String (readonly)
16 17 18 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 16 def patient_refund_id @patient_refund_id end |
#refund_note ⇒ String (readonly)
30 31 32 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 30 def refund_note @refund_note end |
#refund_reason ⇒ CandidApiClient::Financials::Types::RefundReason (readonly)
36 37 38 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 36 def refund_reason @refund_reason end |
#refund_source ⇒ CandidApiClient::Financials::Types::PatientTransactionSource (readonly)
22 23 24 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 22 def refund_source @refund_source end |
#refund_timestamp ⇒ DateTime (readonly)
28 29 30 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 28 def @refund_timestamp end |
#source_internal_id ⇒ String (readonly)
20 21 22 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 20 def source_internal_id @source_internal_id end |
Class Method Details
.from_json(json_object:) ⇒ CandidApiClient::PatientRefunds::V1::Types::PatientRefund
Deserialize a JSON object to an instance of PatientRefund
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 119 120 121 122 123 124 125 126 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 93 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) patient_refund_id = struct["patient_refund_id"] organization_id = struct["organization_id"] source_internal_id = struct["source_internal_id"] refund_source = struct["refund_source"] amount_cents = struct["amount_cents"] patient_external_id = struct["patient_external_id"] = unless parsed_json["refund_timestamp"].nil? DateTime.parse(parsed_json["refund_timestamp"]) end refund_note = struct["refund_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"] refund_reason = struct["refund_reason"] new( patient_refund_id: patient_refund_id, organization_id: organization_id, source_internal_id: source_internal_id, refund_source: refund_source, amount_cents: amount_cents, patient_external_id: patient_external_id, refund_timestamp: , refund_note: refund_note, allocations: allocations, invoice: invoice, refund_reason: refund_reason, 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.
141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 141 def self.validate_raw(obj:) obj.patient_refund_id.is_a?(String) != false || raise("Passed value for field obj.patient_refund_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.refund_source.is_a?(CandidApiClient::Financials::Types::PatientTransactionSource) != false || raise("Passed value for field obj.refund_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.&.is_a?(DateTime) != false || raise("Passed value for field obj.refund_timestamp is not the expected type, validation failed.") obj.refund_note&.is_a?(String) != false || raise("Passed value for field obj.refund_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.") obj.refund_reason&.is_a?(CandidApiClient::Financials::Types::RefundReason) != false || raise("Passed value for field obj.refund_reason is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PatientRefund to a JSON object
131 132 133 |
# File 'lib/candidhealth/patient_refunds/v_1/types/patient_refund.rb', line 131 def to_json(*_args) @_field_set&.to_json end |