Class: CandidApiClient::PatientPayments::V4::AsyncV4Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::PatientPayments::V4::AsyncV4Client

Parameters:



210
211
212
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 210

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



206
207
208
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 206

def request_client
  @request_client
end

Instance Method Details

#create(amount_cents:, patient_external_id:, allocations:, payment_timestamp: nil, payment_note: nil, invoice: nil, request_options: nil) ⇒ CandidApiClient::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.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.patient_payments.v_4.create(
  amount_cents: 1,
  patient_external_id: "patient_external_id",
  allocations: [{ amount_cents: 1 }, { amount_cents: 1 }]
)

Parameters:

  • amount_cents (Integer)
  • payment_timestamp (DateTime) (defaults to: nil)
  • payment_note (String) (defaults to: nil)
  • patient_external_id (String)
  • allocations (Array<Hash>)

    Request of type Array<CandidApiClient::Financials::Types::AllocationCreate>, as a Hash

    • :amount_cents (Integer)

    • :target (Hash)

  • invoice (String) (defaults to: nil)
  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 314

def create(amount_cents:, patient_external_id:, allocations:, payment_timestamp: nil, payment_note: nil,
           invoice: nil, request_options: nil)
  Async do
    response = @request_client.conn.post do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        amount_cents: amount_cents,
        payment_timestamp: payment_timestamp,
        payment_note: payment_note,
        patient_external_id: patient_external_id,
        allocations: allocations,
        invoice: invoice
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/patient-payments/v4"
    end
    CandidApiClient::PatientPayments::V4::Types::PatientPayment.from_json(json_object: response.body)
  end
end

#delete(patient_payment_id:, request_options: nil) ⇒ Void

Deletes the patient payment record matching the provided patient_payment_id.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.patient_payments.v_4.delete(patient_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:

  • (Void)


383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 383

def delete(patient_payment_id:, request_options: nil)
  Async do
    @request_client.conn.delete do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/patient-payments/v4/#{patient_payment_id}"
    end
  end
end

#get(patient_payment_id:, request_options: nil) ⇒ CandidApiClient::PatientPayments::V4::Types::PatientPayment

Retrieves a previously created patient payment by its ‘patient_payment_id`.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.patient_payments.v_4.get(patient_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 274

def get(patient_payment_id:, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/patient-payments/v4/#{patient_payment_id}"
    end
    CandidApiClient::PatientPayments::V4::Types::PatientPayment.from_json(json_object: response.body)
  end
end

#get_multi(limit: nil, patient_external_id: nil, claim_id: nil, service_line_id: nil, billing_provider_id: nil, unattributed: nil, invoice_id: nil, sources: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::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.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.patient_payments.v_4.get_multi

Parameters:

Returns:



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 234

def get_multi(limit: nil, patient_external_id: nil, claim_id: nil, service_line_id: nil,
              billing_provider_id: nil, unattributed: nil, invoice_id: nil, sources: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "limit": limit,
        "patient_external_id": patient_external_id,
        "claim_id": claim_id,
        "service_line_id": service_line_id,
        "billing_provider_id": billing_provider_id,
        "unattributed": unattributed,
        "invoice_id": invoice_id,
        "sources": sources,
        "sort": sort,
        "sort_direction": sort_direction,
        "page_token": page_token
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/patient-payments/v4"
    end
    CandidApiClient::PatientPayments::V4::Types::PatientPaymentsPage.from_json(json_object: response.body)
  end
end

#update(patient_payment_id:, payment_timestamp: nil, payment_note: nil, invoice: nil, request_options: nil) ⇒ CandidApiClient::PatientPayments::V4::Types::PatientPayment

Updates the patient payment record matching the provided patient_payment_id.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.patient_payments.v_4.update(patient_payment_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")

Parameters:

Returns:



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/candidhealth/patient_payments/v_4/client.rb', line 352

def update(patient_payment_id:, payment_timestamp: nil, payment_note: nil, invoice: nil, request_options: nil)
  Async do
    response = @request_client.conn.patch do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        payment_timestamp: payment_timestamp,
        payment_note: payment_note,
        invoice: invoice
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/patient-payments/v4/#{patient_payment_id}"
    end
    CandidApiClient::PatientPayments::V4::Types::PatientPayment.from_json(json_object: response.body)
  end
end