Class: CandidApiClient::PreEncounter::EligibilityChecks::V1::V1Client

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::V1Client

Parameters:



20
21
22
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 20

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



16
17
18
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 16

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:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 92

def batch(request:, request_options: nil)
  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

#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:



119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 119

def poll_batch(batch_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: 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

#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:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/candidhealth/pre_encounter/eligibility_checks/v_1/client.rb', line 52

def post(request:, request_options: nil)
  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