Class: CandidApiClient::ImportInvoice::V1::AsyncV1Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:



181
182
183
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 181

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



177
178
179
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 177

def request_client
  @request_client
end

Instance Method Details

#get(invoice_id:, request_options: nil) ⇒ CandidApiClient::ImportInvoice::V1::Types::ImportInvoice

Retrieve and view an import invoice

Examples:

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

Parameters:

Returns:



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 289

def get(invoice_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/import-invoice/v1/#{invoice_id}"
    end
    CandidApiClient::ImportInvoice::V1::Types::ImportInvoice.from_json(json_object: response.body)
  end
end

#get_multi(patient_external_id: nil, encounter_external_id: nil, note: nil, due_date_before: nil, due_date_after: nil, status: nil, limit: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::ImportInvoice::V1::Types::ImportInvoicesPage

Returns all Invoices for the authenticated user’s organziation with all filters

applied.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.import_invoice.v_1.get_multi(
  patient_external_id: "string",
  encounter_external_id: "string",
  note: "string",
  due_date_before: DateTime.parse(2023-01-15),
  due_date_after: DateTime.parse(2023-01-15),
  status: DRAFT,
  limit: 1,
  sort: CREATED_AT,
  sort_direction: ASC,
  page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9"
)

Parameters:

  • patient_external_id (String) (defaults to: nil)
  • encounter_external_id (String) (defaults to: nil)
  • note (String) (defaults to: nil)

    partial match supported

  • due_date_before (Date) (defaults to: nil)

    all invoices whose due date is before this due date, not inclusive

  • due_date_after (Date) (defaults to: nil)

    all invoices whose due date is after this due date, not inclusive

  • status (CandidApiClient::Invoices::V2::Types::InvoiceStatus) (defaults to: nil)

    all invoices that match any of the provided statuses

  • limit (Integer) (defaults to: nil)

    Defaults to 100

  • sort (CandidApiClient::Invoices::V2::Types::InvoiceSortField) (defaults to: nil)

    Defaults to created_at

  • sort_direction (CandidApiClient::Commons::Types::SortDirection) (defaults to: nil)

    Sort direction. Defaults to descending order

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

Returns:



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 250

def get_multi(patient_external_id: nil, encounter_external_id: nil, note: nil, due_date_before: nil,
              due_date_after: nil, status: nil, limit: 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 || {}),
        "patient_external_id": patient_external_id,
        "encounter_external_id": encounter_external_id,
        "note": note,
        "due_date_before": due_date_before,
        "due_date_after": due_date_after,
        "status": status,
        "limit": limit,
        "sort": sort,
        "sort_direction": sort_direction,
        "page_token": page_token
      }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/import-invoice/v1"
    end
    CandidApiClient::ImportInvoice::V1::Types::ImportInvoicesPage.from_json(json_object: response.body)
  end
end

#import_invoice(request:, request_options: nil) ⇒ CandidApiClient::ImportInvoice::V1::Types::ImportInvoice

Import an existing invoice from a third party service to reflect state in

Candid.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.import_invoice.v_1.import_invoice(request: { external_payment_account_config_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", patient_external_id: "string", external_customer_identifier: "string", note: "string", due_date: DateTime.parse(2023-01-15), items: [{ amount_cents: 1 }], status: DRAFT, external_identifier: "string", customer_invoice_url: "string" })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::ImportInvoice::V1::Types::CreateImportInvoiceRequest, as a Hash

    • :external_payment_account_config_id (String)

    • :patient_external_id (String)

    • :external_customer_identifier (String)

    • :note (String)

    • :due_date (Date)

    • :items (Array<CandidApiClient::Invoices::V2::Types::InvoiceItemCreate>)

    • :status (CandidApiClient::Invoices::V2::Types::InvoiceStatus)

    • :external_identifier (String)

    • :customer_invoice_url (String)

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

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 203

def import_invoice(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/import-invoice/v1"
    end
    CandidApiClient::ImportInvoice::V1::Types::ImportInvoice.from_json(json_object: response.body)
  end
end

#update(invoice_id:, request:, request_options: nil) ⇒ CandidApiClient::ImportInvoice::V1::Types::ImportInvoice

Update the information on the imported invoice

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.import_invoice.v_1.update(invoice_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", request: { customer_invoice_url: "string", status: DRAFT, note: "string", due_date: DateTime.parse(2023-01-15), items: { update_type: APPEND, items: [{ amount_cents: 1 }] } })

Parameters:

  • invoice_id (String)
  • request (Hash)

    Request of type CandidApiClient::ImportInvoice::V1::Types::ImportInvoiceUpdateRequest, as a Hash

    • :customer_invoice_url (String)

    • :status (CandidApiClient::Invoices::V2::Types::InvoiceStatus)

    • :note (String)

    • :due_date (Date)

    • :items (Hash)

      • :update_type (CandidApiClient::ImportInvoice::V1::Types::InvoiceItemUpdateType)

      • :items (Array<CandidApiClient::Invoices::V2::Types::InvoiceItemCreate>)

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

Returns:



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 322

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