Class: Candid::NonInsurancePayerRefunds::V1::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/candid/non_insurance_payer_refunds/v_1/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Candid::NonInsurancePayerRefunds::V1::Client



8
9
10
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 8

def initialize(client:)
  @client = client
end

Instance Method Details

#create(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund

Creates a new non-insurance payer refund record and returns the newly created ‘NonInsurancePayerRefund` object. The allocations can describe whether the refund is being applied toward a specific service line, claim, or billing provider.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 69

def create(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "POST",
    path: "/api/non-insurance-payer-refunds/v1",
    body: Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundCreate.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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end

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

Deletes the non-insurance payer refund record matching the provided ‘non_insurance_payer_refund_id`.

Returns:

  • (untyped)

Raises:

  • (error_class)


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

def delete(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "DELETE",
    path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_id]}"
  )
  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(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund

Retrieves a previously created non-insurance payer refund by its ‘non_insurance_payer_refund_id`.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 44

def get(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end

#get_multi(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage

Returns all non-insurance payer refunds satisfying the search criteria



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 15

def get_multi(request_options: {}, **params)
  params = Candid::Internal::Types::Utils.symbolize_keys(params)
  _query_param_names = %i[limit non_insurance_payer_id check_number invoice_id sort sort_direction page_token]
  _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/non-insurance-payer-refunds/v1",
    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::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefundsPage.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end

#update(request_options: {}, **params) ⇒ Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund

Updates the non-insurance payer refund record matching the provided non_insurance_payer_refund_id. If updating the refund amount, then the allocations must be appropriately updated as well.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/candid/non_insurance_payer_refunds/v_1/client.rb', line 94

def update(request_options: {}, **params)
  _path_param_names = ["non_insurance_payer_refund_id"]

  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "PATCH",
    path: "/api/non-insurance-payer-refunds/v1/#{params[:non_insurance_payer_refund_id]}",
    body: params.except(*_path_param_names)
  )
  begin
    _response = @client.send(_request)
  rescue Net::HTTPRequestTimeout
    raise Candid::Errors::TimeoutError
  end
  code = _response.code.to_i
  if code.between?(200, 299)
    Candid::NonInsurancePayerRefunds::V1::Types::NonInsurancePayerRefund.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end