Class: CandidApiClient::WriteOffs::V1::AsyncV1Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:



161
162
163
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 161

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



157
158
159
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 157

def request_client
  @request_client
end

Instance Method Details

#create(write_offs:, request_options: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::CreateWriteOffsResponse

Creates one or many write-offs 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.write_offs.v_1.create(write_offs: )

Parameters:

  • write_offs (Array<Hash>)

    Request of type Array<CandidApiClient::WriteOffs::V1::Types::WriteOffCreate>, as a Hash

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

Returns:



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 258

def create(write_offs:, 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 || {}), write_offs: write_offs }.compact
      req.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/write-offs/v1"
    end
    CandidApiClient::WriteOffs::V1::Types::CreateWriteOffsResponse.from_json(json_object: response.body)
  end
end

#get(write_off_id:, request_options: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::WriteOff

Retrieves a previously created write off by its ‘write_off_id`.

Examples:

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

Parameters:

Returns:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 232

def get(write_off_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/write-offs/v1/#{write_off_id}"
    end
    CandidApiClient::WriteOffs::V1::Types::WriteOff.from_json(json_object: response.body)
  end
end

#get_multi(limit: nil, patient_external_id: nil, payer_uuid: nil, service_line_id: nil, claim_id: nil, billing_provider_id: nil, sort: nil, sort_direction: nil, page_token: nil, account_types: nil, request_options: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::WriteOffsPage

Returns all write-offs satisfying the search criteria.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.write_offs.v_1.get_multi(
  limit: 1,
  patient_external_id: "string",
  payer_uuid: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  service_line_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  claim_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  billing_provider_id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  sort: AMOUNT_CENTS,
  sort_direction: ASC,
  page_token: "eyJ0b2tlbiI6IjEiLCJwYWdlX3Rva2VuIjoiMiJ9",
  account_types: PATIENT
)

Parameters:

Returns:



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 193

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

#revert(write_off_id:, request_options: nil) ⇒ CandidApiClient::WriteOffs::V1::Types::WriteOff

Reverts a write off given a ‘write_off_id`.

Examples:

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

Parameters:

Returns:



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/candidhealth/write_offs/v_1/client.rb', line 284

def revert(write_off_id:, 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.url "#{@request_client.get_url(environment: CandidApi,
                                         request_options: request_options)}/api/write-offs/v1/#{write_off_id}/revert"
    end
    CandidApiClient::WriteOffs::V1::Types::WriteOff.from_json(json_object: response.body)
  end
end