candidhealth 0.36.1 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "charge_capture_status"
4
+ require_relative "charge_capture_data"
5
+ require "ostruct"
6
+ require "json"
7
+
8
+ module CandidApiClient
9
+ module ChargeCapture
10
+ module V1
11
+ module Types
12
+ class ChargeCapture
13
+ # @return [String]
14
+ attr_reader :id
15
+ # @return [CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureStatus]
16
+ attr_reader :status
17
+ # @return [CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureData]
18
+ attr_reader :charge_capture_data
19
+ # @return [String]
20
+ attr_reader :patient_external_id
21
+ # @return [String]
22
+ attr_reader :encounter_external_id
23
+ # @return [String]
24
+ attr_reader :ehr_source_url
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param id [String]
34
+ # @param status [CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureStatus]
35
+ # @param charge_capture_data [CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureData]
36
+ # @param patient_external_id [String]
37
+ # @param encounter_external_id [String]
38
+ # @param ehr_source_url [String]
39
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
40
+ # @return [CandidApiClient::ChargeCapture::V1::Types::ChargeCapture]
41
+ def initialize(id:, status:, charge_capture_data:, patient_external_id:, encounter_external_id:,
42
+ ehr_source_url: OMIT, additional_properties: nil)
43
+ @id = id
44
+ @status = status
45
+ @charge_capture_data = charge_capture_data
46
+ @patient_external_id = patient_external_id
47
+ @encounter_external_id = encounter_external_id
48
+ @ehr_source_url = ehr_source_url if ehr_source_url != OMIT
49
+ @additional_properties = additional_properties
50
+ @_field_set = {
51
+ "id": id,
52
+ "status": status,
53
+ "charge_capture_data": charge_capture_data,
54
+ "patient_external_id": patient_external_id,
55
+ "encounter_external_id": encounter_external_id,
56
+ "ehr_source_url": ehr_source_url
57
+ }.reject do |_k, v|
58
+ v == OMIT
59
+ end
60
+ end
61
+
62
+ # Deserialize a JSON object to an instance of ChargeCapture
63
+ #
64
+ # @param json_object [String]
65
+ # @return [CandidApiClient::ChargeCapture::V1::Types::ChargeCapture]
66
+ def self.from_json(json_object:)
67
+ struct = JSON.parse(json_object, object_class: OpenStruct)
68
+ parsed_json = JSON.parse(json_object)
69
+ id = struct["id"]
70
+ status = struct["status"]
71
+ if parsed_json["charge_capture_data"].nil?
72
+ charge_capture_data = nil
73
+ else
74
+ charge_capture_data = parsed_json["charge_capture_data"].to_json
75
+ charge_capture_data = CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureData.from_json(json_object: charge_capture_data)
76
+ end
77
+ patient_external_id = struct["patient_external_id"]
78
+ encounter_external_id = struct["encounter_external_id"]
79
+ ehr_source_url = struct["ehr_source_url"]
80
+ new(
81
+ id: id,
82
+ status: status,
83
+ charge_capture_data: charge_capture_data,
84
+ patient_external_id: patient_external_id,
85
+ encounter_external_id: encounter_external_id,
86
+ ehr_source_url: ehr_source_url,
87
+ additional_properties: struct
88
+ )
89
+ end
90
+
91
+ # Serialize an instance of ChargeCapture to a JSON object
92
+ #
93
+ # @return [String]
94
+ def to_json(*_args)
95
+ @_field_set&.to_json
96
+ end
97
+
98
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
99
+ # hash and check each fields type against the current object's property
100
+ # definitions.
101
+ #
102
+ # @param obj [Object]
103
+ # @return [Void]
104
+ def self.validate_raw(obj:)
105
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
106
+ obj.status.is_a?(CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
107
+ CandidApiClient::ChargeCapture::V1::Types::ChargeCaptureData.validate_raw(obj: obj.charge_capture_data)
108
+ obj.patient_external_id.is_a?(String) != false || raise("Passed value for field obj.patient_external_id is not the expected type, validation failed.")
109
+ obj.encounter_external_id.is_a?(String) != false || raise("Passed value for field obj.encounter_external_id is not the expected type, validation failed.")
110
+ obj.ehr_source_url&.is_a?(String) != false || raise("Passed value for field obj.ehr_source_url is not the expected type, validation failed.")
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end