Class: DaVinciPDexTestKit::PDexPayerClient::MockServer::PatientEverythingEndpoint

Inherits:
ProxyEndpoint
  • Object
show all
Defined in:
lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_everything_endpoint.rb

Constant Summary

Constants included from URLs

URLs::AUTHORIZATION_PATH, URLs::BASE_FHIR_PATH, URLs::BINARY_PATH, URLs::EVERYTHING_PATH, URLs::EXPORT_PATH, URLs::EXPORT_STATUS_PATH, URLs::INSTANCE_PATH, URLs::MEMBER_MATCH_PATH, URLs::METADATA_PATH, URLs::PATIENT_INSTANCE_PATH, URLs::PATIENT_PATH, URLs::RESOURCE_PATH, URLs::RESUME_CLINICAL_DATA_PATH, URLs::RESUME_FAIL_PATH, URLs::RESUME_PASS_PATH, URLs::TOKEN_PATH

Instance Method Summary collapse

Methods inherited from ProxyEndpoint

#server_proxy, #test_run_identifier, #update_result

Methods included from URLs

#base_url, #client_fhir_base_url, #fhir_base_url, #suite_id

Instance Method Details

#make_responseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_everything_endpoint.rb', line 9

def make_response
  # server_response = proxy_request(request, strict: false) # disable strict to allow $everything request without parameters
  # response = proxy_response(server_response)
  patient_id = request.url.match(/Patient\/([A-Za-z0-9\-\.]{1,64})\/\$everything/)&.to_a&.at(1)

  if patient_id.nil?
    response.status = 400
    response.body = "Invalid patient id for Patient $everything request: #{request.url}"
    response.format = :text
  else
    server_response = server_proxy.get("Patient/#{patient_id}/$everything")
  
    response.status = server_response.status
    response.body = replace_bundle_urls(FHIR.from_contents(server_response.body)).to_json
    response.format = 'application/fhir+json'
  end
end

#tagsObject



27
28
29
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/patient_everything_endpoint.rb', line 27

def tags
  [EVERYTHING_TAG]
end