Class: DaVinciDTRTestKit::MockPayer::NextQuestionEndpoint
- Inherits:
-
Inferno::DSL::SuiteEndpoint
- Object
- Inferno::DSL::SuiteEndpoint
- DaVinciDTRTestKit::MockPayer::NextQuestionEndpoint
show all
- Includes:
- DaVinciDTRTestKit::MockPayer
- Defined in:
- lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb
Instance Method Summary
collapse
#build_outcome_param, #find_questionnaire_response, #operation_outcome, #outcome_issue, #parse_fhir_object
Instance Method Details
#complete_questionnaire? ⇒ Boolean
44
45
46
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 44
def complete_questionnaire?
custom_questionnaires && next_custom_questionnaire.blank?
end
|
#custom_next_question_requests ⇒ Object
25
26
27
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 25
def custom_next_question_requests
requests_repo.tagged_requests(test_run.test_session_id, ["custom_#{DaVinciDTRTestKit::CLIENT_NEXT_TAG}"])
end
|
#custom_questionnaires ⇒ Object
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 29
def custom_questionnaires
return @custom_questionnaires unless @custom_questionnaires.nil?
questionnaires = JSON.parse(result.input_json)
.find { |input| input['name'].include?('custom_next_question_questionnaires') }
&.dig('value')
return unless questionnaires
@custom_questionnaires = [JSON.parse(questionnaires)].flatten.compact
end
|
#make_response ⇒ Object
18
19
20
21
22
23
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 18
def make_response
response.status = 200
response.format = 'application/fhir+json'
response.['Access-Control-Allow-Origin'] = '*'
response.body = build_questionnaire_next_response.to_json
end
|
#next_custom_questionnaire ⇒ Object
40
41
42
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 40
def next_custom_questionnaire
custom_questionnaires[custom_next_question_requests.length]
end
|
14
15
16
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 14
def tags
[test.config.options[:next_tag]]
end
|
#test_run_identifier ⇒ Object
10
11
12
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 10
def test_run_identifier
MockAuthorization.(request)
end
|
#update_result ⇒ Object
48
49
50
|
# File 'lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb', line 48
def update_result
results_repo.update_result(result.id, 'pass') unless test.config.options[:accepts_multiple_requests]
end
|