Class: Candid::FeeSchedules::V3::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candid/fee_schedules/v_3/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, base_url: nil, environment: nil) ⇒ void

Parameters:



12
13
14
15
16
# File 'lib/candid/fee_schedules/v_3/client.rb', line 12

def initialize(client:, base_url: nil, environment: nil)
  @client = client
  @base_url = base_url
  @environment = environment
end

Instance Method Details

#delete_rate(request_options: {}, **params) ⇒ untyped

Soft deletes a rate from the system. Only the most recent version of a rate can be deleted.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

  • (untyped)

Raises:

  • (error_class)


303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/candid/fee_schedules/v_3/client.rb', line 303

def delete_rate(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "DELETE",
    path: "/api/fee-schedules/v3/#{params[:rate_id]}/#{params[:version]}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_match(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::MatchResult?

Gets the rate that matches a service line. No result means no rate exists matching the service line’s dimensions.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/candid/fee_schedules/v_3/client.rb', line 31

def get_match(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/service-line/#{params[:service_line_id]}/match",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_multi(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::RatesPage

Gets a list of dimensions with their rates. The rates returned will always be the most recent versions of those rates.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/candid/fee_schedules/v_3/client.rb', line 111

def get_multi(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[page_token limit active_date payer_uuid organization_billing_provider_id states zip_codes license_types facility_type_codes network_types payer_plan_group_ids cpt_code modifiers]
  query_params = {}
  query_params["page_token"] = params[:page_token] if params.key?(:page_token)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["active_date"] = params[:active_date] if params.key?(:active_date)
  query_params["payer_uuid"] = params[:payer_uuid] if params.key?(:payer_uuid)
  query_params["organization_billing_provider_id"] = params[:organization_billing_provider_id] if params.key?(:organization_billing_provider_id)
  query_params["states"] = params[:states] if params.key?(:states)
  query_params["zip_codes"] = params[:zip_codes] if params.key?(:zip_codes)
  query_params["license_types"] = params[:license_types] if params.key?(:license_types)
  query_params["facility_type_codes"] = params[:facility_type_codes] if params.key?(:facility_type_codes)
  query_params["network_types"] = params[:network_types] if params.key?(:network_types)
  query_params["payer_plan_group_ids"] = params[:payer_plan_group_ids] if params.key?(:payer_plan_group_ids)
  query_params["cpt_code"] = params[:cpt_code] if params.key?(:cpt_code)
  query_params["modifiers"] = params[:modifiers] if params.key?(:modifiers)
  params.except(*query_param_names)

  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::RatesPage.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_payer_thresholds(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::PayerThresholdsPage

Gets a list of payers and thresholds by their uuids

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/candid/fee_schedules/v_3/client.rb', line 368

def get_payer_thresholds(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[payer_uuids]
  query_params = {}
  query_params["payer_uuids"] = params[:payer_uuids] if params.key?(:payer_uuids)
  params.except(*query_param_names)

  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/payer-threshold",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::PayerThresholdsPage.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_payer_thresholds_default(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::PayerThreshold

Gets the default payer threshold

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/candid/fee_schedules/v_3/client.rb', line 334

def get_payer_thresholds_default(request_options: {}, **params)
  Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/payer-threshold/default",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::PayerThreshold.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_rate_history(request_options: {}, **params) ⇒ Array[Candid::FeeSchedules::V3::Types::Rate]

Gets every version of a rate.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:

Raises:

  • (error_class)


228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/candid/fee_schedules/v_3/client.rb', line 228

def get_rate_history(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/#{params[:rate_id]}/history",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#get_unique_values_for_dimension(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::DimensionsPage

Gets unique values for a dimension based on other selection criteria. The response is a list of dimensions with your criteria and the unique values populated. This API is useful for driving pivots on dimension values.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/candid/fee_schedules/v_3/client.rb', line 176

def get_unique_values_for_dimension(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[page_token limit pivot_dimension payer_uuid organization_billing_provider_id states zip_codes license_types facility_type_codes network_types payer_plan_group_ids cpt_code modifiers]
  query_params = {}
  query_params["page_token"] = params[:page_token] if params.key?(:page_token)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["pivot_dimension"] = params[:pivot_dimension] if params.key?(:pivot_dimension)
  query_params["payer_uuid"] = params[:payer_uuid] if params.key?(:payer_uuid)
  query_params["organization_billing_provider_id"] = params[:organization_billing_provider_id] if params.key?(:organization_billing_provider_id)
  query_params["states"] = params[:states] if params.key?(:states)
  query_params["zip_codes"] = params[:zip_codes] if params.key?(:zip_codes)
  query_params["license_types"] = params[:license_types] if params.key?(:license_types)
  query_params["facility_type_codes"] = params[:facility_type_codes] if params.key?(:facility_type_codes)
  query_params["network_types"] = params[:network_types] if params.key?(:network_types)
  query_params["payer_plan_group_ids"] = params[:payer_plan_group_ids] if params.key?(:payer_plan_group_ids)
  query_params["cpt_code"] = params[:cpt_code] if params.key?(:cpt_code)
  query_params["modifiers"] = params[:modifiers] if params.key?(:modifiers)
  params.except(*query_param_names)

  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/unique-dimension-values",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::DimensionsPage.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#hard_delete_rates(request_options: {}, **params) ⇒ Integer

Hard deletes rates from the system that match the provided dimensions. This is a destructive operation and cannot be undone. If an empty dimensions object is provided, all rates will be hard deleted. The maximum number of rates this API will delete at a time is 10000. Returns the number of rates deleted and if that number is the maximum, the caller should call this API again to continue deleting rates.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Integer)

Raises:

  • (error_class)


445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/candid/fee_schedules/v_3/client.rb', line 445

def hard_delete_rates(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "POST",
    path: "/api/fee-schedules/v3/hard-delete",
    body: Candid::FeeSchedules::V3::Types::OptionalDimensions.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#hard_delete_rates_by_ids(request_options: {}, **params) ⇒ Integer

Hard deletes specific rates from the system by their IDs. This is a destructive operation and cannot be undone. Limited to 100 rate IDs maximum per request. For bulk deletion of more than 100 rates, use the hard_delete_rates endpoint with dimension filters. Returns the number of rates deleted.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

  • (Integer)

Raises:

  • (error_class)


479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# File 'lib/candid/fee_schedules/v_3/client.rb', line 479

def hard_delete_rates_by_ids(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "POST",
    path: "/api/fee-schedules/v3/hard-delete-by-ids",
    body: Candid::FeeSchedules::V3::Types::HardDeleteRatesByIdsRequest.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end

#set_payer_threshold(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::PayerThreshold

Sets the threshold information for a payer

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/candid/fee_schedules/v_3/client.rb', line 408

def set_payer_threshold(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "PUT",
    path: "/api/fee-schedules/v3/payer-threshold/#{params[:payer_uuid]}",
    body: Candid::FeeSchedules::V3::Types::PayerThreshold.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::PayerThreshold.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#test_match(request_options: {}, **params) ⇒ Candid::FeeSchedules::V3::Types::MatchTestResult

Tests a service line against a rate to see if it matches.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/candid/fee_schedules/v_3/client.rb', line 64

def test_match(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "GET",
    path: "/api/fee-schedules/v3/service-line/#{params[:service_line_id]}/match/#{params[:rate_id]}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Candid::FeeSchedules::V3::Types::MatchTestResult.load(response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#upload_fee_schedule(request_options: {}, **params) ⇒ Array[Candid::FeeSchedules::V3::Types::Rate]

Uploads a new fee schedule.

Each rate may either be totally new as qualified by it’s dimensions or a new version for an existing rate.

If adding a new version to an existing rate, the rate must be posted with the next version number (previous version + 1) or a EntityConflictError will be returned.

Use the dry run flag to discover already existing rates and to run validations. If validations for any rate fail, no rates will be saved to the system.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:

Raises:

  • (error_class)


269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/candid/fee_schedules/v_3/client.rb', line 269

def upload_fee_schedule(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.normalize_keys(params)
  request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || @base_url || @environment&.dig(:candid_api),
    method: "POST",
    path: "/api/fee-schedules/v3",
    body: Candid::FeeSchedules::V3::Types::FeeScheduleUploadRequest.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Candid::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end