Class: CandidApiClient::InsuranceRefunds::V1::AsyncV1Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/insurance_refunds/v_1/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::InsuranceRefunds::V1::AsyncV1Client

Parameters:



204
205
206
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 204

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



200
201
202
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 200

def request_client
  @request_client
end

Instance Method Details

#create(request:, request_options: nil) ⇒ CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund

Creates a new insurance refund record and returns the newly created

`InsuranceRefund` object.
The allocations can describe whether the refund 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.insurance_refunds.v_1.create(request: { amount_cents: 1, refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z), refund_note: "string", allocations: [{ amount_cents: 1 }], refund_reason: OVERCHARGED })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefundCreate, as a Hash

    • :payer_identifier (Hash)

    • :amount_cents (Integer)

    • :refund_timestamp (DateTime)

    • :refund_note (String)

    • :allocations (Array<CandidApiClient::Financials::Types::AllocationCreate>)

    • :refund_reason (CandidApiClient::Financials::Types::RefundReason)

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

Returns:



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 307

def create(request:, 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 || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/insurance-refunds/v1"
    end
    CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund.from_json(json_object: response.body)
  end
end

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

Deletes the insurance refund record matching the provided ‘insurance_refund_id`.

If the matching record's organization_id does not match the authenticated user's
current organization_id, then a response code of `403` will be returned.

Examples:

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

Parameters:

Returns:

  • (Void)


372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 372

def delete(insurance_refund_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/insurance-refunds/v1/#{insurance_refund_id}"
    end
  end
end

#get(insurance_refund_id:, request_options: nil) ⇒ CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund

Retrieves a previously created insurance refund by its ‘insurance_refund_id`.

If the refund does not exist, a `403` will be thrown.

Examples:

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

Parameters:

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 272

def get(insurance_refund_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/insurance-refunds/v1/#{insurance_refund_id}"
    end
    CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund.from_json(json_object: response.body)
  end
end

#get_multi(limit: nil, payer_uuid: nil, claim_id: nil, service_line_id: nil, billing_provider_id: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefundsPage

Returns all insurance refunds 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.insurance_refunds.v_1.get_multi(
  limit: 1,
  payer_uuid: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  claim_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  service_line_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  billing_provider_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  sort: AMOUNT_CENTS,
  sort_direction: ASC,
  page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9"
)

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
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 234

def get_multi(limit: nil, payer_uuid: nil, claim_id: nil, service_line_id: nil, billing_provider_id: 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,
        "payer_uuid": payer_uuid,
        "claim_id": claim_id,
        "service_line_id": service_line_id,
        "billing_provider_id": billing_provider_id,
        "sort": sort,
        "sort_direction": sort_direction,
        "page_token": page_token
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/insurance-refunds/v1"
    end
    CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefundsPage.from_json(json_object: response.body)
  end
end

#update(insurance_refund_id:, refund_timestamp: nil, refund_note: nil, refund_reason: nil, request_options: nil) ⇒ CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund

Updates the patient refund record matching the provided insurance_refund_id. If

updating the refund amount,
then the allocations must be appropriately updated as well.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.insurance_refunds.v_1.update(insurance_refund_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", refund_timestamp: DateTime.parse(2024-01-15T09:30:00.000Z))

Parameters:

Returns:



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/candidhealth/insurance_refunds/v_1/client.rb', line 338

def update(insurance_refund_id:, refund_timestamp: nil, refund_note: nil, refund_reason: 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 || {}),
        refund_timestamp: refund_timestamp,
        refund_note: refund_note,
        refund_reason: refund_reason
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/insurance-refunds/v1/#{insurance_refund_id}"
    end
    CandidApiClient::InsuranceRefunds::V1::Types::InsuranceRefund.from_json(json_object: response.body)
  end
end