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
608 609 610 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 608 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ CandidApiClient::AsyncRequestClient (readonly)
604 605 606 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 604 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.
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1124 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: 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.
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1158 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: 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.
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 763 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: 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
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 999 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: 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.
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1190 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: 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.
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1025 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: 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.
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1054 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: 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.
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 966 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: 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.
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 1088 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: 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 next version number to prevent
race conditions. For example, if the current version of the coverage is n, you
will need to send a request to this endpoint with `/{id}/n+1` to update the
coverage. Updating historic versions is not supported.
937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
# File 'lib/candidhealth/pre_encounter/coverages/v_1/client.rb', line 937 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: request_options)}/coverages/v1/#{id}/#{version}" end CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage.from_json(json_object: response.body) end end |