Class: Candid::PatientRefunds::V1::Client
- Inherits:
-
Object
- Object
- Candid::PatientRefunds::V1::Client
- Defined in:
- lib/candid/patient_refunds/v_1/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Creates a new patient refund record and returns the newly created PatientRefund object.
-
#delete(request_options: {}, **params) ⇒ untyped
Deletes the patient refund record matching the provided patient_refund_id.
-
#get(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Retrieves a previously created patient refund by its ‘patient_refund_id`.
-
#get_multi(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefundsPage
Returns all patient refunds satisfying the search criteria AND whose organization_id matches the current organization_id of the authenticated user.
- #initialize(client:, base_url: nil, environment: nil) ⇒ void constructor
-
#update(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Updates the patient refund record matching the provided patient_refund_id.
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
12 13 14 15 16 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 12 def initialize(client:, base_url: nil, environment: nil) @client = client @base_url = base_url @environment = environment end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Creates a new patient refund record and returns the newly created PatientRefund object. The allocations can describe whether the refund is being applied toward a specific service line, claim, or billing provider.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 126 def create(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "POST", path: "/api/patient-refunds/v1", body: Candid::PatientRefunds::V1::Types::PatientRefundCreate.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PatientRefunds::V1::Types::PatientRefund.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Deletes the patient refund record matching the provided patient_refund_id.
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 200 def delete(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "DELETE", path: "/api/patient-refunds/v1/#{params[:patient_refund_id]}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#get(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Retrieves a previously created patient refund by its ‘patient_refund_id`.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 91 def get(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "GET", path: "/api/patient-refunds/v1/#{params[:patient_refund_id]}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PatientRefunds::V1::Types::PatientRefund.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_multi(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefundsPage
Returns all patient refunds satisfying the search criteria AND whose organization_id matches the current organization_id of the authenticated user.
41 42 43 44 45 46 47 48 49 50 51 52 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 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 41 def get_multi(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[limit patient_external_id claim_id service_line_id billing_provider_id unattributed invoice_id sources sort sort_direction page_token] query_params = {} query_params["limit"] = params[:limit] if params.key?(:limit) query_params["patient_external_id"] = params[:patient_external_id] if params.key?(:patient_external_id) query_params["claim_id"] = params[:claim_id] if params.key?(:claim_id) query_params["service_line_id"] = params[:service_line_id] if params.key?(:service_line_id) query_params["billing_provider_id"] = params[:billing_provider_id] if params.key?(:billing_provider_id) query_params["unattributed"] = params[:unattributed] if params.key?(:unattributed) query_params["invoice_id"] = params[:invoice_id] if params.key?(:invoice_id) query_params["sources"] = params[:sources] if params.key?(:sources) query_params["sort"] = params[:sort] if params.key?(:sort) query_params["sort_direction"] = params[:sort_direction] if params.key?(:sort_direction) query_params["page_token"] = params[:page_token] if params.key?(:page_token) params.except(*query_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "GET", path: "/api/patient-refunds/v1", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PatientRefunds::V1::Types::PatientRefundsPage.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Candid::PatientRefunds::V1::Types::PatientRefund
Updates the patient refund record matching the provided patient_refund_id.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/candid/patient_refunds/v_1/client.rb', line 161 def update(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request_data = Candid::PatientRefunds::V1::Types::PatientRefundUpdate.new(params).to_h non_body_param_names = ["patient_refund_id"] body = request_data.except(*non_body_param_names) request = Candid::Internal::JSON::Request.new( base_url: [:base_url] || @base_url || @environment&.dig(:candid_api), method: "PATCH", path: "/api/patient-refunds/v1/#{params[:patient_refund_id]}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Candid::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Candid::PatientRefunds::V1::Types::PatientRefund.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |