Class: CandidApiClient::PreEncounter::Coverages::V1::V1Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::V1Client

Parameters:



23
24
25
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 23

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientCandidApiClient::RequestClient (readonly)



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

def request_client
  @request_client
end

Instance Method Details

#check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata

Initiates an eligibility check. Returns the metadata of the check if

successfully initiated.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.coverages.v_1.check_eligibility(
  id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  service_code: MEDICAL_CARE,
  date_of_service: DateTime.parse(2023-01-15),
  npi: "string"
)

Parameters:

Returns:



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 371

def check_eligibility(id:, service_code:, date_of_service:, npi:, 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_options&.additional_body_parameters || {}),
      service_code: service_code,
      date_of_service: date_of_service,
      npi: npi
    }.compact
    req.url "#{@request_client.get_url(environment: PreEncounter,
                                       request_options: request_options)}/coverages/v1/#{id}/eligibility"
  end
  CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata.from_json(json_object: response.body)
end

#create(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage

Creates a new Coverage. A Coverage provides the high-level identifiers and

descriptors of a specific insurance plan for a specific individual - typically
the information you can find on an insurance card. Additionally a coverage will
include detailed benefits information covered by the specific plan for the
individual.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.coverages.v_1.create(request: { status: ACTIVE, subscriber: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE, address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } } }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", additional_payer_information: { availity_eligibility_id: "string", availity_payer_id: "string", availity_payer_name: "string", availity_remittance_payer_id: "string" }, group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: {  }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], latest_eligibility_check: { check_id: "string", status: ACTIVE, initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }, benefits: {  } })

Parameters:

  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage, as a Hash

    • :status (CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus)

    • :subscriber (Hash)

      • :name (Hash)

        • :family (String)

        • :given (Array<String>)

        • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :date_of_birth (Date)

      • :biological_sex (CandidApiClient::PreEncounter::Common::Types::Sex)

      • :address (Hash)

        • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

        • :line (Array<String>)

        • :city (String)

        • :state (String)

        • :postal_code (String)

        • :country (String)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

    • :relationship (CandidApiClient::PreEncounter::Common::Types::Relationship)

    • :patient (String)

    • :insurance_plan (Hash)

      • :member_id (String)

      • :payer_id (String)

      • :payer_name (String)

      • :additional_payer_information (Hash)

        • :availity_eligibility_id (String)

        • :availity_payer_id (String)

        • :availity_payer_name (String)

        • :availity_remittance_payer_id (String)

      • :group_number (String)

      • :name (String)

      • :plan_type (CandidApiClient::PreEncounter::Coverages::V1::Types::NetworkType)

      • :type (CandidApiClient::PreEncounter::Coverages::V1::Types::InsuranceTypeCode)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

      • :insurance_card_image_locator (String)

    • :verified (Boolean)

    • :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)

    • :latest_eligibility_check (Hash)

      • :check_id (String)

      • :status (CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus)

      • :initiated_at (DateTime)

    • :benefits (Hash)

      • :plan_coverage (Hash)

        • :in_network (Hash)

          • :deductible (Hash)

            • :family (Float)

            • :individual (Float)

          • :deductible_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :additional_notes (String)

        • :in_network_flat (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails>)

        • :out_of_network (Hash)

          • :deductible (Hash)

            • :family (Float)

            • :individual (Float)

          • :deductible_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :additional_notes (String)

        • :out_of_network_flat (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails>)

      • :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)

      • :notes (String)

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

Returns:



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

def create(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)}/coverages/v1"
  end
  CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body)
end

#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage

gets a specific Coverage

Examples:

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

Parameters:

Returns:



254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 254

def get(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)}/coverages/v1/#{id}"
  end
  CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body)
end

#get_eligibility(id:, check_id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse

Gets the eligibility of a patient for a specific coverage if successful.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.coverages.v_1.get_eligibility(id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", check_id: "string")

Parameters:

Returns:



401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 401

def get_eligibility(id:, check_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)}/coverages/v1/#{id}/eligibility/#{check_id}"
  end
  CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse.from_json(json_object: response.body)
end

#get_history(id:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage>

Gets a coverage along with it’s full history. The return list is ordered by

version ascending.

Examples:

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

Parameters:

Returns:



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 278

def get_history(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)}/coverages/v1/#{id}/history"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: item)
  end
end

#get_multi(patient_id: nil, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage>

Returns a list of Coverages based on the search criteria.

Examples:

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

Parameters:

Returns:



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 305

def get_multi(patient_id: 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 || {}), "patient_id": patient_id }.compact
    req.url "#{@request_client.get_url(environment: PreEncounter,
                                       request_options: request_options)}/coverages/v1"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: item)
  end
end

#scan(since:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage>

Scans up to 100 coverage updates. The since query parameter is inclusive, and

the result list is ordered by updatedAt ascending.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.coverages.v_1.scan(since: DateTime.parse(2024-01-15T09:30:00.000Z))

Parameters:

Returns:



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 334

def scan(since:, 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 || {}), "since": since }.compact
    req.url "#{@request_client.get_url(environment: PreEncounter,
                                       request_options: request_options)}/coverages/v1/updates/scan"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: item)
  end
end

#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage

Updates a Coverage. The path must contain the most recent version to prevent

race conditions. Updating historic versions is not supported.

Examples:

api = CandidApiClient::Client.new(base_url: "https://api.example.com", environment: CandidApiClient::Environment::PRODUCTION)
api.pre_encounter.coverages.v_1.update(
  id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  version: "string",
  request: { status: ACTIVE, subscriber: { name: { family: "string", given: ["string"], use: USUAL, period: {  } }, date_of_birth: DateTime.parse(2023-01-15), biological_sex: FEMALE, address: { use: HOME, line: ["string"], city: "string", state: "string", postal_code: "string", country: "string", period: {  } } }, relationship: SELF, patient: "string", insurance_plan: { member_id: "string", payer_id: "string", payer_name: "string", additional_payer_information: { availity_eligibility_id: "string", availity_payer_id: "string", availity_payer_name: "string", availity_remittance_payer_id: "string" }, group_number: "string", name: "string", plan_type: SELF_PAY, type: C_01, period: {  }, insurance_card_image_locator: "string" }, verified: true, eligibility_checks: [{ check_id: "string", service_code: MEDICAL_CARE, status: CREATED, initiated_by: "string", initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }], latest_eligibility_check: { check_id: "string", status: ACTIVE, initiated_at: DateTime.parse(2024-01-15T09:30:00.000Z) }, benefits: {  } }
)

Parameters:

  • id (String)
  • version (String)
  • request (Hash)

    Request of type CandidApiClient::PreEncounter::Coverages::V1::Types::MutableCoverage, as a Hash

    • :status (CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageStatus)

    • :subscriber (Hash)

      • :name (Hash)

        • :family (String)

        • :given (Array<String>)

        • :use (CandidApiClient::PreEncounter::Common::Types::NameUse)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

      • :date_of_birth (Date)

      • :biological_sex (CandidApiClient::PreEncounter::Common::Types::Sex)

      • :address (Hash)

        • :use (CandidApiClient::PreEncounter::Common::Types::AddressUse)

        • :line (Array<String>)

        • :city (String)

        • :state (String)

        • :postal_code (String)

        • :country (String)

        • :period (Hash)

          • :start (Date)

          • :end_ (Date)

    • :relationship (CandidApiClient::PreEncounter::Common::Types::Relationship)

    • :patient (String)

    • :insurance_plan (Hash)

      • :member_id (String)

      • :payer_id (String)

      • :payer_name (String)

      • :additional_payer_information (Hash)

        • :availity_eligibility_id (String)

        • :availity_payer_id (String)

        • :availity_payer_name (String)

        • :availity_remittance_payer_id (String)

      • :group_number (String)

      • :name (String)

      • :plan_type (CandidApiClient::PreEncounter::Coverages::V1::Types::NetworkType)

      • :type (CandidApiClient::PreEncounter::Coverages::V1::Types::InsuranceTypeCode)

      • :period (Hash)

        • :start (Date)

        • :end_ (Date)

      • :insurance_card_image_locator (String)

    • :verified (Boolean)

    • :eligibility_checks (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityCheckMetadata>)

    • :latest_eligibility_check (Hash)

      • :check_id (String)

      • :status (CandidApiClient::PreEncounter::Coverages::V1::Types::EligibilityStatus)

      • :initiated_at (DateTime)

    • :benefits (Hash)

      • :plan_coverage (Hash)

        • :in_network (Hash)

          • :deductible (Hash)

            • :family (Float)

            • :individual (Float)

          • :deductible_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :additional_notes (String)

        • :in_network_flat (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails>)

        • :out_of_network (Hash)

          • :deductible (Hash)

            • :family (Float)

            • :individual (Float)

          • :deductible_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max (Hash)

            • :family (Float)

            • :individual (Float)

          • :oop_max_remaining (Hash)

            • :family (Float)

            • :individual (Float)

          • :additional_notes (String)

        • :out_of_network_flat (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageDetails>)

      • :service_specific_coverage (Array<CandidApiClient::PreEncounter::Coverages::V1::Types::ServiceCoverage>)

      • :notes (String)

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

Returns:



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 230

def update(id:, version:, request:, request_options: nil)
  response = @request_client.conn.put 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)}/coverages/v1/#{id}/#{version}"
  end
  CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body)
end