Class: Candid::InsurancePayments::V1::Client

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

Instance Method Summary collapse

Constructor Details

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



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

def initialize(client:)
  @client = client
end

Instance Method Details

#get(request_options: {}, **params) ⇒ Candid::InsurancePayments::V1::Types::InsurancePayment

Retrieves a previously created insurance payment by its ‘insurance_payment_id`. If the payment does not exist, a `403` will be thrown.



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

def get(request_options: {}, **params)
  _request = Candid::Internal::JSON::Request.new(
    base_url: request_options[:base_url] || Candid::Environment::PRODUCTION,
    method: "GET",
    path: "/api/insurance-payments/v1/#{params[:insurance_payment_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::InsurancePayments::V1::Types::InsurancePayment.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::InsurancePayments::V1::Types::InsurancePaymentsPage

Returns all non-ERA originated insurance payments 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
40
# File 'lib/candid/insurance_payments/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 payer_uuid claim_id service_line_id billing_provider_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/insurance-payments/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::InsurancePayments::V1::Types::InsurancePaymentsPage.load(_response.body)
  else
    error_class = Candid::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(_response.body, code: code)
  end
end