Class: CandidApiClient::PreEncounter::Coverages::V1::V1Client
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Coverages::V1::V1Client
- Defined in:
- lib/candidhealth/pre_encounter/coverages/v_1/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#batch_update_ppg(ppg_id:, request:, request_options: nil) ⇒ Void
Finds all coverages associated with the given ppg_id and updates the ppg_fields for each coverage.
-
#check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckMetadata
Initiates an eligibility check.
-
#create(request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage
Creates a new Coverage.
-
#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage
gets a specific Coverage.
-
#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.
-
#get_history(id:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage>
Gets a coverage along with it’s full history.
-
#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.
-
#get_multi_paginated(patient_id: nil, payer_plan_group_id: nil, page_token: nil, limit: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::CoveragesPage
Returns a page of Coverages based on the search criteria.
- #initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::V1Client constructor
-
#scan(since:, request_options: nil) ⇒ Array<CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage>
Scans up to 100 coverage updates.
-
#update(id:, version:, request:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage
Updates a Coverage.
Constructor Details
#initialize(request_client:) ⇒ CandidApiClient::PreEncounter::Coverages::V1::V1Client
25 26 27 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 25 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::RequestClient (readonly)
21 22 23 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 21 def request_client @request_client end |
Instance Method Details
#batch_update_ppg(ppg_id:, request:, request_options: nil) ⇒ Void
Finds all coverages associated with the given ppg_id and updates the ppg_fields
for each coverage.
522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 522 def batch_update_ppg(ppg_id:, request:, request_options: nil) @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(request || {}), **(&.additional_body_parameters || {}) }.compact req.url "#{@request_client.get_url(environment: PreEncounter, request_options: request_options)}/coverages/v1/batch-update-ppg/#{ppg_id}" end end |
#check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) ⇒ CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckMetadata
Initiates an eligibility check. Returns the metadata of the check if
successfully initiated.
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 554 def check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(&.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::EligibilityChecks::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.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 180 def create(request:, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(request || {}), **(&.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
408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 408 def get(id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.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.
584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 584 def get_eligibility(id:, check_id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.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.
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 432 def get_history(id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.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.
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 459 def get_multi(patient_id: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.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 |
#get_multi_paginated(patient_id: nil, payer_plan_group_id: nil, page_token: nil, limit: nil, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::CoveragesPage
Returns a page of Coverages based on the search criteria.
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 377 def get_multi_paginated(patient_id: nil, payer_plan_group_id: nil, page_token: nil, limit: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "patient_id": patient_id, "payer_plan_group_id": payer_plan_group_id, "page_token": page_token, "limit": limit }.compact req.url "#{@request_client.get_url(environment: PreEncounter, request_options: request_options)}/coverages/v1/get-multi-paginated" end CandidApiClient::PreEncounter::Coverages::V1::Types::CoveragesPage.from_json(json_object: response.body) 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.
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 488 def scan(since:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.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.
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 350 def update(id:, version:, request:, request_options: nil) response = @request_client.conn.put do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.body = { **(request || {}), **(&.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 |