Module: ONCCertificationG10TestKit::ExportKickOffPerformer

Defined in:
lib/onc_certification_g10_test_kit/export_kick_off_performer.rb

Instance Method Summary collapse

Instance Method Details

#delete_export_kick_off_requestObject



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

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: {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/onc_certification_g10_test_kit/export_kick_off_performer.rb', line 3

def perform_export_kick_off_request(use_token: true, params: {})
  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

  url = "Group/#{group_id}/$export"
  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