Class: Candid::PatientPayments::V4::Client
- Inherits:
-
Object
- Object
- Candid::PatientPayments::V4::Client
- Defined in:
- lib/candid/patient_payments/v_4/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Candid::PatientPayments::V4::Types::PatientPayment
Creates a new patient payment record and returns the newly created PatientPayment object.
-
#delete(request_options: {}, **params) ⇒ untyped
Deletes the patient payment record matching the provided patient_payment_id.
-
#get(request_options: {}, **params) ⇒ Candid::PatientPayments::V4::Types::PatientPayment
Retrieves a previously created patient payment by its ‘patient_payment_id`.
-
#get_multi(request_options: {}, **params) ⇒ Candid::PatientPayments::V4::Types::PatientPaymentsPage
Returns all patient payments 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::PatientPayments::V4::Types::PatientPayment
Updates the patient payment record matching the provided patient_payment_id.
Constructor Details
#initialize(client:, base_url: nil, environment: nil) ⇒ void
12 13 14 15 16 |
# File 'lib/candid/patient_payments/v_4/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::PatientPayments::V4::Types::PatientPayment
Creates a new patient payment record and returns the newly created PatientPayment object. The allocations can describe whether the payment is being applied toward a specific service line, claim, or billing provider.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/candid/patient_payments/v_4/client.rb', line 128 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-payments/v4", body: Candid::PatientPayments::V4::Types::PatientPaymentCreate.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::PatientPayments::V4::Types::PatientPayment.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 payment record matching the provided patient_payment_id.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/candid/patient_payments/v_4/client.rb', line 202 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-payments/v4/#{params[:patient_payment_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::PatientPayments::V4::Types::PatientPayment
Retrieves a previously created patient payment by its ‘patient_payment_id`.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/candid/patient_payments/v_4/client.rb', line 93 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-payments/v4/#{params[:patient_payment_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::PatientPayments::V4::Types::PatientPayment.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::PatientPayments::V4::Types::PatientPaymentsPage
Returns all patient payments satisfying the search criteria AND whose organization_id matches the current organization_id of the authenticated user.
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 78 79 |
# File 'lib/candid/patient_payments/v_4/client.rb', line 42 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 source_internal_id 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["source_internal_id"] = params[:source_internal_id] if params.key?(:source_internal_id) 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-payments/v4", 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::PatientPayments::V4::Types::PatientPaymentsPage.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::PatientPayments::V4::Types::PatientPayment
Updates the patient payment record matching the provided patient_payment_id.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/candid/patient_payments/v_4/client.rb', line 163 def update(request_options: {}, **params) params = Candid::Internal::Types::Utils.normalize_keys(params) request_data = Candid::PatientPayments::V4::Types::PatientPaymentUpdate.new(params).to_h non_body_param_names = ["patient_payment_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-payments/v4/#{params[:patient_payment_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::PatientPayments::V4::Types::PatientPayment.load(response.body) else error_class = Candid::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |