Class: CandidApiClient::PreEncounter::Coverages::V1::AsyncV1Client
- Inherits:
-
Object
- Object
- CandidApiClient::PreEncounter::Coverages::V1::AsyncV1Client
- 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::AsyncV1Client 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::AsyncV1Client
606 607 608 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 606 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::AsyncRequestClient (readonly)
602 603 604 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 602 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.
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1120 def batch_update_ppg(ppg_id:, request:, request_options: nil) Async do @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: )}/coverages/v1/batch-update-ppg/#{ppg_id}" end 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.
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1154 def check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) Async do 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: )}/coverages/v1/#{id}/eligibility" end CandidApiClient::PreEncounter::EligibilityChecks::V1::Types::EligibilityCheckMetadata.from_json(json_object: response.body) end 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.
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 761 def create(request:, request_options: nil) Async do 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: )}/coverages/v1" end CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body) end end |
#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage
gets a specific Coverage
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 995 def get(id:, request_options: nil) Async do 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: )}/coverages/v1/#{id}" end CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body) end 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.
1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1186 def get_eligibility(id:, check_id:, request_options: nil) Async do 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: )}/coverages/v1/#{id}/eligibility/#{check_id}" end CandidApiClient::PreEncounter::Coverages::V1::Types::CoverageEligibilityCheckResponse.from_json(json_object: response.body) end 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.
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1021 def get_history(id:, request_options: nil) Async do 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: )}/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 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.
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1050 def get_multi(patient_id: nil, request_options: nil) Async do 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: )}/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 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.
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 962 def get_multi_paginated(patient_id: nil, payer_plan_group_id: nil, page_token: nil, limit: nil, request_options: nil) Async do 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: )}/coverages/v1/get-multi-paginated" end CandidApiClient::PreEncounter::Coverages::V1::Types::CoveragesPage.from_json(json_object: response.body) 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.
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1084 def scan(since:, request_options: nil) Async do 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: )}/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 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.
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 933 def update(id:, version:, request:, request_options: nil) Async do 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: )}/coverages/v1/#{id}/#{version}" end CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body) end end |