Class: CandidApiClient::InsurancePayments::V1::V1Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::InsurancePayments::V1::V1Client



19
20
21
# File 'lib/candidhealth/insurance_payments/v_1/client.rb', line 19

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



15
16
17
# File 'lib/candidhealth/insurance_payments/v_1/client.rb', line 15

def request_client
  @request_client
end

Instance Method Details

#get(insurance_payment_id:, request_options: nil) ⇒ CandidApiClient::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.

Examples:

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


74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/candidhealth/insurance_payments/v_1/client.rb', line 74

def get(insurance_payment_id:, request_options: nil)
  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/insurance-payments/v1/#{insurance_payment_id}"
  end
  CandidApiClient::InsurancePayments::V1::Types::InsurancePayment.from_json(json_object: response.body)
end

#get_multi(limit: nil, payer_uuid: nil, claim_id: nil, service_line_id: nil, billing_provider_id: nil, sort: nil, sort_direction: nil, page_token: nil, request_options: nil) ⇒ CandidApiClient::InsurancePayments::V1::Types::InsurancePaymentsPage

Returns all non-ERA originated insurance payments satisfying the search criteria

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.insurance_payments.v_1.get_multi


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/candidhealth/insurance_payments/v_1/client.rb', line 38

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