lib/ddr/utils.rb in ddr-models-3.0.0.beta.18 vs lib/ddr/utils.rb in ddr-models-3.0.0.beta.20

- old
+ new

@@ -1,8 +1,9 @@ require 'openssl' module Ddr::Utils + extend Deprecation DEFAULT_MIME_TYPE = "application/octet-stream" def self.digest(content, algorithm) raise TypeError, "Algorithm must be a string: #{algorithm.inspect}" unless algorithm.is_a?(String) @@ -88,9 +89,10 @@ # model: Will only consider objects of that model # collection: Will only consider objects that either are that collection or which are # direct children of that collection (i.e., effectively searches a collection and its # items for an object with the given identifier) def self.pid_for_identifier(identifier, opts={}) + Deprecation.warn(self, "`Ddr::Utils.pid_for_identifier` is deprecated. Use .having_local_id model class method and get id from result object(s). (#{caller.first})") model = opts.fetch(:model, nil) collection = opts.fetch(:collection, nil) objs = [] ActiveFedora::Base.find_each( { Ddr::Index::Fields::IDENTIFIER_ALL => identifier }, { :cast => true } ) { |o| objs << o } pids = []