Module: DaVinciPASTestKit::UserInputResponse
- Included in:
- DaVinciPASV201::PASClientApprovalSubmitTest, DaVinciPASV201::PASClientDenialGroup, DaVinciPASV201::PASClientDenialSubmitTest, DaVinciPASV201::PASClientPendedGroup, DaVinciPASV201::PASClientPendedSubmitTest, DaVinciPASV201::PasClientInquireResponseBundleValidationTest, DaVinciPASV201::PasClientResponseBundleValidationTest
- Defined in:
- lib/davinci_pas_test_kit/user_input_response.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
3 4 5 |
# File 'lib/davinci_pas_test_kit/user_input_response.rb', line 3 def self.included(klass) klass.extend ClassMethods end |
.user_inputted_response(configurable, operation, result) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/davinci_pas_test_kit/user_input_response.rb', line 7 def self.user_inputted_response(configurable, operation, result) config_key = operation == 'submit' ? :submit_respond_with : :inquire_respond_with input_key = configurable.config.[config_key] return unless input_key.present? JSON.parse(result.input_json)&.find { |i| i['name'] == input_key.to_s }&.dig('value') rescue JSON::ParserError nil end |
Instance Method Details
#input_title(input_key) ⇒ Object
21 22 23 |
# File 'lib/davinci_pas_test_kit/user_input_response.rb', line 21 def input_title(input_key) config.inputs[input_key]&.title || config.inputs[input_key]&.name end |
#user_inputted_response?(input_key) ⇒ Boolean
17 18 19 |
# File 'lib/davinci_pas_test_kit/user_input_response.rb', line 17 def user_inputted_response?(input_key) send(input_key).present? end |