Class: IpaTestKit::Generator::IGResources
- Inherits:
-
Object
- Object
- IpaTestKit::Generator::IGResources
- Defined in:
- lib/ipa_test_kit/generator/ig_resources.rb
Instance Method Summary collapse
- #add(resource) ⇒ Object
- #capability_statement(mode = 'server') ⇒ Object
- #ig ⇒ Object
- #inspect ⇒ Object
- #profile_by_url(url) ⇒ Object
- #resource_for_profile(url) ⇒ Object
- #search_param_by_resource_and_name(resource, name) ⇒ Object
- #value_set_by_url(url) ⇒ Object
Instance Method Details
#add(resource) ⇒ Object
4 5 6 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 4 def add(resource) resources_by_type[resource.resourceType] << resource end |
#capability_statement(mode = 'server') ⇒ Object
8 9 10 11 12 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 8 def capability_statement(mode = 'server') resources_by_type['CapabilityStatement'].find do |capability_statement_resource| capability_statement_resource.rest.any? { |r| r.mode == mode } end end |
#ig ⇒ Object
14 15 16 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 14 def ig resources_by_type['ImplementationGuide'].first end |
#inspect ⇒ Object
18 19 20 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 18 def inspect 'IGResources' end |
#profile_by_url(url) ⇒ Object
22 23 24 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 22 def profile_by_url(url) resources_by_type['StructureDefinition'].find { |profile| profile.url == url } end |
#resource_for_profile(url) ⇒ Object
26 27 28 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 26 def resource_for_profile(url) resources_by_type['StructureDefinition'].find { |profile| profile.url == url }.type end |
#search_param_by_resource_and_name(resource, name) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 34 def search_param_by_resource_and_name(resource, name) # remove '_' from search parameter name, such as _id or _tag normalized_name = normalized_name = name.to_s.delete_prefix('_') resources_by_type['SearchParameter'] .find { |param| param.id == "us-core-#{resource.downcase}-#{normalized_name}" } end |
#value_set_by_url(url) ⇒ Object
30 31 32 |
# File 'lib/ipa_test_kit/generator/ig_resources.rb', line 30 def value_set_by_url(url) resources_by_type['ValueSet'].find { |profile| profile.url == url } end |