From 59e7ca8c13078c13c7895152c5d24c41a7e98995 Mon Sep 17 00:00:00 2001 From: lsitu Date: Fri, 20 Sep 2019 15:55:27 -0700 Subject: [PATCH] Fix failed tests that are relying on the method_missing method. --- .../models/concerns/pcdm_valkyrie_behavior.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb b/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb index 26dccba173..10c9c187d8 100644 --- a/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb +++ b/lib/wings/hydra/pcdm/models/concerns/pcdm_valkyrie_behavior.rb @@ -137,6 +137,24 @@ def original_file af_object.original_file end + ## + # @return [Boolean] whether this instance is an audio. + def audio? + af_object = Wings::ActiveFedoraConverter.new(resource: self).convert + af_object.audio? + end + + # TODO: This can be removed when we upgrade to ActiveFedora 12.0 + # @return [String] the etag from the response headers + # + # @raise [RuntimeError] when the resource is new and has no etag + # @raise [Ldp::Gone] when the resource is deleted + def etag + raise "Unable to produce an etag for a unsaved object" unless persisted? + af_object = Wings::ActiveFedoraConverter.new(resource: self).convert + af_object.ldp_source.head.etag + end + # @param valkyrie [Boolean] Should the returned ids be for Valkyrie or AF objects? # @return [Enumerable] The works this work is contained in # @note This method avoids using the Hydra::Works version of parent_works because of Issue #361