Class: CandidApiClient::ImportInvoice::V1::V1Client

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::V1Client

Parameters:



23
24
25
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 23

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



19
20
21
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 19

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:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 127

def get(invoice_id:, request_options: nil)
  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

#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:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 90

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)
  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

#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:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 45

def import_invoice(request:, request_options: nil)
  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

#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:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/candidhealth/import_invoice/v_1/client.rb', line 158

def update(invoice_id:, request:, request_options: nil)
  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