Class: CandidApiClient::PreEncounter::EligibilityChecks::V1::AsyncV1Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::AsyncV1Client

Parameters:



141
142
143
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 141

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::AsyncRequestClient (readonly)



137
138
139
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 137

def request_client
  @request_client
end

Instance Method Details

#batch(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::BatchEligibilityResponse

Sends a batch of eligibility checks to payers through Stedi.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.eligibility_checks.v_1.batch(request: [{ payer_id: "payer_id", provider: { npi: "npi" }, subscriber: { first_name: "first_name", last_name: "last_name" } }, { payer_id: "payer_id", provider: { npi: "npi" }, subscriber: { first_name: "first_name", last_name: "last_name" } }])

Parameters:

  • request (Array<Hash>)

    Request of type Array<CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest>, as a Hash

    • :submitter_transaction_identifier (String)

    • :payer_id (String)

    • :provider (Hash)

    • :subscriber (Hash)

      • :member_id (String)

      • :first_name (String)

      • :last_name (String)

      • :date_of_birth (Date)

    • :dependent (Hash)

      • :member_id (String)

      • :first_name (String)

      • :last_name (String)

      • :date_of_birth (Date)

    • :encounter (Hash)

      • :date_of_service (Date)

      • :service_type_codes (Array<String>)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 215

def batch(request:, request_options: nil)
  Async do
    response = @request_client.conn.post 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.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/eligibility-checks/v1/batch"
    end
    CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::BatchEligibilityResponse.from_json(json_object: response.body)
  end
end

#poll_batch(batch_id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage

Polls the status of a batch eligibility check.

<Note>Batch eligibility checks are not yet available. Please reach out to the
Candid team for more information.</Note>
path-parameters:

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.eligibility_checks.v_1.poll_batch(batch_id: "batch_id")

Parameters:

Returns:



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 244

def poll_batch(batch_id:, request_options: nil)
  Async do
    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: PreEncounter,
                                         request_options: request_options)}/eligibility-checks/v1/batch/#{batch_id}"
    end
    CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckPage.from_json(json_object: response.body)
  end
end

#post(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::ELIGIBILITY_RESPONSE

Sends real-time eligibility checks to payers through Stedi.

<Warning>Please only send one concurrent request to this endpoint. Batch
requests must be made in succession, otherwise, it will cause this service to
fail. A batch endpoint is in development - please reach out to the Candid team
for more information.</Warning>

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.eligibility_checks.v_1.post(request: { payer_id: "payer_id", provider: { npi: "npi" }, subscriber: { first_name: "first_name", last_name: "last_name" } })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityRequest, as a Hash

    • :submitter_transaction_identifier (String)

    • :payer_id (String)

    • :provider (Hash)

    • :subscriber (Hash)

      • :member_id (String)

      • :first_name (String)

      • :last_name (String)

      • :date_of_birth (Date)

    • :dependent (Hash)

      • :member_id (String)

      • :first_name (String)

      • :last_name (String)

      • :date_of_birth (Date)

    • :encounter (Hash)

      • :date_of_service (Date)

      • :service_type_codes (Array<String>)

  • request_options (CandidApiClient::RequestOptions) (defaults to: nil)

Returns:



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 173

def post(request:, request_options: nil)
  Async do
    response = @request_client.conn.post 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.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
      req.url "#{@request_client.get_url(environment: PreEncounter,
                                         request_options: request_options)}/eligibility-checks/v1"
    end
    CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheck.from_json(json_object: response.body)
  end
end