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:) ⇒ Candid::FeeSchedules::V3::Client



8
9
10
# File 'lib/candid/fee_schedules/v_3/client.rb', line 8

def initialize(client:)
  @client = client
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.

Returns:

  • (untyped)

Raises:

  • (error_class)


162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/candid/fee_schedules/v_3/client.rb', line 162

def delete_rate(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "DELETE",
    path: "/api/fee-schedules/v3/#{params[:rate_id]}/#{params[:version]}"
  )
  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 | nil

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

Returns:

Raises:

  • (error_class)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/candid/fee_schedules/v_3/client.rb', line 15

def get_match(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/service-line/#{params[:service_line_id]}/match"
  )
  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.



59
60
61
62
63
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 59

def get_multi(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_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.slice(*_query_param_names)
  params.except(*_query_param_names)

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3",
    query: _query
  )
  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



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/candid/fee_schedules/v_3/client.rb', line 206

def get_payer_thresholds(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_keys(params)
  _query_param_names = i[payer_uuids]
  _query = params.slice(*_query_param_names)
  params.except(*_query_param_names)

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/payer-threshold",
    query: _query
  )
  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



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/candid/fee_schedules/v_3/client.rb', line 183

def get_payer_thresholds_default(request_options: {}, **_params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/payer-threshold/default"
  )
  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.

Returns:

Raises:

  • (error_class)


119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/candid/fee_schedules/v_3/client.rb', line 119

def get_rate_history(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/#{params[:rate_id]}/history"
  )
  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.



89
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
# File 'lib/candid/fee_schedules/v_3/client.rb', line 89

def get_unique_values_for_dimension(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_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.slice(*_query_param_names)
  params.except(*_query_param_names)

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/unique-dimension-values",
    query: _query
  )
  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.

Returns:

  • (Integer)

Raises:

  • (error_class)


259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/candid/fee_schedules/v_3/client.rb', line 259

def hard_delete_rates(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "POST",
    path: "/api/fee-schedules/v3/hard-delete",
    body: Candid::FeeSchedules::V3::Types::OptionalDimensions.new(params).to_h
  )
  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.

Returns:

  • (Integer)

Raises:

  • (error_class)


281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/candid/fee_schedules/v_3/client.rb', line 281

def hard_delete_rates_by_ids(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "POST",
    path: "/api/fee-schedules/v3/hard-delete-by-ids",
    body: params
  )
  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



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/candid/fee_schedules/v_3/client.rb', line 235

def set_payer_threshold(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "PUT",
    path: "/api/fee-schedules/v3/payer-threshold/#{params[:payer_uuid]}",
    body: Candid::FeeSchedules::V3::Types::PayerThreshold.new(params).to_h
  )
  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.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/candid/fee_schedules/v_3/client.rb', line 36

def test_match(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/fee-schedules/v3/service-line/#{params[:service_line_id]}/match/#{params[:rate_id]}"
  )
  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.n Each rate may either be totally new as qualified by it’s dimensions or a new version for an existing rate.n 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.n 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.

Returns:

Raises:

  • (error_class)


140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/candid/fee_schedules/v_3/client.rb', line 140

def upload_fee_schedule(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "POST",
    path: "/api/fee-schedules/v3",
    body: params
  )
  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