Module: AUPSTestKit::BasicTestAuthorResource

Included in:
BasicTestAuthorModule
Defined in:
lib/au_ps_inferno/utils/author/basic_test_author_resource.rb

Overview

Resolves Composition.author reference from the scratch bundle.

Instance Method Summary collapse

Instance Method Details

#author_resourceObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/au_ps_inferno/utils/author/basic_test_author_resource.rb', line 8

def author_resource
  return nil unless scratch_bundle.present?

  bundle_resource = BundleDecorator.new(scratch_bundle)
  composition_resource = bundle_resource.composition_resource
  return nil unless composition_resource.present?

  author_ref = first_composition_author_reference(composition_resource)
  return nil unless author_ref.present?

  ref_str = author_ref.respond_to?(:reference) ? author_ref.reference : author_ref['reference']
  return nil if ref_str.blank?

  bundle_resource.resource_by_reference(ref_str)
end