Module: BulkDataTestKit::ExportKickOffPerformer

Instance Method Summary collapse

Instance Method Details

#delete_export_kick_off_requestObject



16
17
18
19
20
21
22
23
24
# File 'lib/bulk_data_test_kit/export_kick_off_performer.rb', line 16

def delete_export_kick_off_request
  polling_url = request&.response_header('content-location')&.value
  assert polling_url.present?, 'Export response header did not include "Content-Location"'

  headers = { accept: 'application/json', authorization: "Bearer #{bearer_token}" }

  delete(polling_url, headers:)
  assert_response_status(202)
end

#perform_export_kick_off_request(use_token: true, params: {}, url: '') ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/bulk_data_test_kit/export_kick_off_performer.rb', line 5

def perform_export_kick_off_request(use_token: true, params: {}, url: '')
  skip_if use_token && bearer_token.blank?, 'Could not verify this functionality when bearer token is not set'

  headers = { accept: 'application/fhir+json', prefer: 'respond-async' }
  headers.merge!({ authorization: "Bearer #{bearer_token}" }) if use_token

  param_str = params.map { |k, v| URI.encode_www_form(k => v) }.join('&')
  url.concat("?#{param_str}") unless param_str.empty?
  get(url, client: :bulk_server, name: :export, headers:)
end