Class: DaVinciPASTestKit::Generator::IGResources

Inherits:
Object
  • Object
show all
Defined in:
lib/davinci_pas_test_kit/generator/ig_resources.rb

Instance Method Summary collapse

Instance Method Details

#add(resource) ⇒ Object



4
5
6
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 4

def add(resource)
  resources_by_type[resource.resourceType] << resource
end

#base_resources_and_supported_profilesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 14

def base_resources_and_supported_profiles
  definitions = [
    'ImplementationGuide',
    'CapabilityStatement',
    'CodeSystem',
    'OperationDefinition',
    'StructureDefinition',
    'ValueSet'
  ]
  base_resources = resources_by_type.keys.reject { |k| definitions.include?(k) }
  resource_profiles = {}
  base_resources.each do |res|
    profile_urls = resources_by_type['StructureDefinition'].find_all { |p| p.type == res }.map(&:url)
    resource_profiles[res] = profile_urls
  end
  resource_profiles
end

#capability_statement(mode = 'server') ⇒ Object



8
9
10
11
12
# File 'lib/davinci_pas_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

#code_system_by_url(url) ⇒ Object



52
53
54
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 52

def code_system_by_url(url)
  resources_by_type['CodeSystem'].find { |profile| profile.url == url }
end

#igObject



32
33
34
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 32

def ig
  resources_by_type['ImplementationGuide'].first
end

#inspectObject



36
37
38
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 36

def inspect
  'IGResources'
end

#profile_by_url(url) ⇒ Object



40
41
42
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 40

def profile_by_url(url)
  resources_by_type['StructureDefinition'].find { |profile| profile.url == url }
end

#resource_type_for_profile(url) ⇒ Object



44
45
46
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 44

def resource_type_for_profile(url)
  profile_by_url(url).type
end

#value_set_by_url(url) ⇒ Object



48
49
50
# File 'lib/davinci_pas_test_kit/generator/ig_resources.rb', line 48

def value_set_by_url(url)
  resources_by_type['ValueSet'].find { |profile| profile.url == url }
end