Class: DaVinciPDexTestKit::PDexPayerClient::MockServer::ExportStatusEndpoint
- Inherits:
-
ProxyEndpoint
- Object
- Inferno::DSL::SuiteEndpoint
- ProxyEndpoint
- DaVinciPDexTestKit::PDexPayerClient::MockServer::ExportStatusEndpoint
- Includes:
- URLs
- Defined in:
- lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_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 included from URLs
#base_url, #client_fhir_base_url, #fhir_base_url, #suite_id
Methods inherited from ProxyEndpoint
#server_proxy, #test_run_identifier, #update_result
Instance Method Details
#make_response ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb', line 12 def make_response http_headers_as_hash = request.env.select { |k,v| k.start_with? 'HTTP_'}.transform_keys { |k| k.sub(/^HTTP_/, '').split('_').map(&:capitalize).join('-') } server_response = server_proxy.get do |req| req.url '$export-poll-status' req.params = request.params req.headers = http_headers_as_hash.merge(server_proxy.headers) end if server_response.status.to_s.starts_with?('4') || server_response.status.to_s.starts_with?('5') response.format = 'application/fhir+json' elsif server_response.status.to_i == 202 response.format = 'application/json' end response.body = (server_response.status.to_i == 200) ? replace_export_urls(JSON.parse(server_response.body)).to_json : server_response.body response.status = server_response.status end |
#replace_export_urls(export_status_output) ⇒ Object
35 36 37 38 39 |
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb', line 35 def replace_export_urls(export_status_output) export_status_output['output'].map! { |binary| {type: binary["type"], url: binary["url"].gsub(fhir_reference_server, fhir_base_url)} } export_status_output['request'] = export_url export_status_output end |
#tags ⇒ Object
31 32 33 |
# File 'lib/davinci_pdex_test_kit/pdex_payer_client/mock_server/export_status_endpoint.rb', line 31 def [EXPORT_STATUS_TAG] end |