Class: DaVinciPASTestKit::Generator::ServerMustSupportGroupGenerator
- Inherits:
-
Object
- Object
- DaVinciPASTestKit::Generator::ServerMustSupportGroupGenerator
- Defined in:
- lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb
Instance Attribute Summary collapse
-
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
-
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
Class Method Summary collapse
Instance Method Summary collapse
- #base_output_file_name ⇒ Object
- #class_name ⇒ Object
- #description ⇒ Object
- #generate ⇒ Object
- #group_id ⇒ Object
- #ig_version ⇒ Object
- #ig_version_for_id ⇒ Object
-
#initialize(ig_metadata, base_output_dir) ⇒ ServerMustSupportGroupGenerator
constructor
A new instance of ServerMustSupportGroupGenerator.
- #module_name ⇒ Object
- #output ⇒ Object
- #output_file_name ⇒ Object
- #profile_identifier(profile_metadata) ⇒ Object
- #profile_identifier_for_profile(profile_metadata) ⇒ Object
- #profile_test_files(operation, type) ⇒ Object
- #profile_test_ids(operation, type) ⇒ Object
- #profiles_for(operation, type) ⇒ Object
- #request_profiles ⇒ Object
- #subgroup_description(operation) ⇒ Object
- #template ⇒ Object
- #test_file_for_profile(profile_metadata, operation, type) ⇒ Object
- #test_id_for_profile(profile_metadata, operation, type) ⇒ Object
- #title ⇒ Object
- #verifies_must_support_requirements(operation, type) ⇒ Object
- #verifies_requirements ⇒ Object
Constructor Details
#initialize(ig_metadata, base_output_dir) ⇒ ServerMustSupportGroupGenerator
Returns a new instance of ServerMustSupportGroupGenerator.
14 15 16 17 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 14 def initialize(, base_output_dir) self. = self.base_output_dir = base_output_dir end |
Instance Attribute Details
#base_output_dir ⇒ Object
Returns the value of attribute base_output_dir.
12 13 14 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 12 def base_output_dir @base_output_dir end |
#ig_metadata ⇒ Object
Returns the value of attribute ig_metadata.
12 13 14 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 12 def @ig_metadata end |
Class Method Details
.generate(ig_metadata, base_server_output_dir) ⇒ Object
7 8 9 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 7 def generate(, base_server_output_dir) new(, base_server_output_dir).generate end |
Instance Method Details
#base_output_file_name ⇒ Object
27 28 29 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 27 def base_output_file_name "#{class_name.underscore}.rb" end |
#class_name ⇒ Object
31 32 33 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 31 def class_name 'PASServerMustSupportGroup' end |
#description ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 129 def description <<~DESCRIPTION Demonstrate the ability of the server to support all PAS-defined profiles and the must support elements defined in them. This includes - the ability to respond to prior authorization submission and inquiry requests that contain all PAS-defined profiles and their must support elements. - the ability to include in those responses all PAS-defined profiles and their must support elements. In order to allow Inferno to observe and validate these criteria, testers are required to provide a set of `$submit` and `$inquire` requests that collectively both themselves contain and elicit server responses that contain all PAS-defined profiles and their must support elements. DESCRIPTION end |
#generate ⇒ Object
63 64 65 66 67 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 63 def generate FileUtils.mkdir_p(base_output_dir) File.write(output_file_name, output) .add_use_case_groups(group_id, base_output_file_name) end |
#group_id ⇒ Object
51 52 53 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 51 def group_id "pas_server_#{ig_version_for_id}_must_support" end |
#ig_version ⇒ Object
55 56 57 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 55 def ig_version .ig_version end |
#ig_version_for_id ⇒ Object
59 60 61 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 59 def ig_version_for_id .reformatted_version end |
#module_name ⇒ Object
35 36 37 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 35 def module_name "DaVinciPAS#{ig_version_for_id.upcase}" end |
#output ⇒ Object
23 24 25 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 23 def output @output ||= ERB.new(template, trim_mode: '-').result(binding) end |
#output_file_name ⇒ Object
43 44 45 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 43 def output_file_name File.join(base_output_dir, base_output_file_name) end |
#profile_identifier(profile_metadata) ⇒ Object
47 48 49 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 47 def profile_identifier() .snake_case_for_profile() end |
#profile_identifier_for_profile(profile_metadata) ⇒ Object
79 80 81 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 79 def profile_identifier_for_profile() .snake_case_for_profile() end |
#profile_test_files(operation, type) ⇒ Object
87 88 89 90 91 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 87 def profile_test_files(operation, type) profiles_for(operation, type).map do || test_file_for_profile(, operation, type) end end |
#profile_test_ids(operation, type) ⇒ Object
83 84 85 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 83 def profile_test_ids(operation, type) profiles_for(operation, type).map { || test_id_for_profile(, operation, type) } end |
#profiles_for(operation, type) ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 93 def profiles_for(operation, type) .profiles.select do |profile| case "#{operation}_#{type}" when 'submit_request' MustSupportTargetProfiles.submit_request_profile?(profile) && !MustSupportTargetProfiles.request_profile?(profile) when 'submit_response' MustSupportTargetProfiles.submit_response_profile?(profile) when 'inquire_request' MustSupportTargetProfiles.inquire_request_profile?(profile) when 'inquire_response' MustSupportTargetProfiles.inquire_response_profile?(profile) end end end |
#request_profiles ⇒ Object
109 110 111 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 109 def request_profiles .profiles.select { || MustSupportTargetProfiles.request_profile?() } end |
#subgroup_description(operation) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 147 def subgroup_description(operation) <<~DESCRIPTION Check that the provided `$#{operation}` requests both themselves contain and elicit server responses that contain all PAS-defined profiles and their must support elements. For `$#{operation}` requests, this includes the following profiles: #{Descriptions.profile_links_list(profiles_for(operation, 'request'), ig_version, request_profiles: operation == 'submit' ? request_profiles : nil)} For `$#{operation}` responses, this includes the following profiles (NOTE: request-specific profiles that may be echoed from `$#{operation}` requests, such as the Claim instance or request instances, are not currently checked): #{Descriptions.profile_links_list(profiles_for(operation, 'response'), ig_version)} DESCRIPTION end |
#template ⇒ Object
19 20 21 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 19 def template @template ||= File.read(File.join(__dir__, 'templates', 'server_must_support_group.rb.erb')) end |
#test_file_for_profile(profile_metadata, operation, type) ⇒ Object
74 75 76 77 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 74 def test_file_for_profile(, operation, type) profile_id = profile_identifier_for_profile() File.join(profile_id, "server_#{operation}_#{type}_must_support_#{profile_id}_test") end |
#test_id_for_profile(profile_metadata, operation, type) ⇒ Object
69 70 71 72 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 69 def test_id_for_profile(, operation, type) "pas_server_#{ig_version_for_id}_#{operation}_#{type}_" \ "must_support_#{profile_identifier_for_profile()}" end |
#title ⇒ Object
39 40 41 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 39 def title 'Demonstrate Element Support' end |
#verifies_must_support_requirements(operation, type) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 120 def verifies_must_support_requirements(operation, type) case "#{operation}_#{type}_#{.ig_version}" when 'submit_request_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@35'] when 'inquire_request_v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@36'] end end |
#verifies_requirements ⇒ Object
113 114 115 116 117 118 |
# File 'lib/davinci_pas_test_kit/generator/server_must_support_group_generator.rb', line 113 def verifies_requirements case .ig_version when 'v2.0.1' ['hl7.fhir.us.davinci-pas_2.0.1@33'] end end |