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
-
#check_eligibility(id:, service_code:, date_of_service:, npi:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::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.
- #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
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_client ⇒ CandidApiClient::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.
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..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::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.
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..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 |
#get(id:, request_options: nil) ⇒ CandidApiClient::PreEncounter::Coverages::V1::Types::Coverage
gets a specific Coverage
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..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 |
#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.
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..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 |
#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.
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..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 |
#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.
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..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 |
#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.
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..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 |
#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.
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..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 |