Class: Ddr::Managers::PermanentIdManager Private
- Inherits:
-
Object
- Object
- Ddr::Managers::PermanentIdManager
- Defined in:
- lib/ddr/managers/permanent_id_manager.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
PermanentIdManager is responsible for managing the permanent id for an object.
Defined Under Namespace
Classes: AssignmentJob
Constant Summary collapse
- PERMANENT_URL_BASE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"http://id.library.duke.edu/"
- TARGET_URL_BASE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"https://repository.lib.duke.edu/id/"
- ASSIGN_EVENT_SUMMARY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"Permanent ID assignment"
- SOFTWARE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Ezid::Client.version
Instance Attribute Summary collapse
- #object ⇒ Object readonly private
Instance Method Summary collapse
- #assign ⇒ Object private
- #assign_later ⇒ Object private
- #default_metadata ⇒ Object private
-
#initialize(object) ⇒ PermanentIdManager
constructor
private
A new instance of PermanentIdManager.
- #record ⇒ Object private
Constructor Details
#initialize(object) ⇒ PermanentIdManager
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PermanentIdManager.
22 23 24 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 22 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 20 def object @object end |
Instance Method Details
#assign ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 30 def assign raise Ddr::Models::Error, "Permanent ID already assigned." if object.permanent_id ActiveSupport::Notifications.instrument(Ddr::Notifications::UPDATE, pid: object.pid, software: SOFTWARE, summary: ASSIGN_EVENT_SUMMARY ) do |payload| assign! payload[:detail] = <<-EOS Permanent ID: #{object.permanent_id} Permanent URL: #{object.permanent_url} EZID Metadata: #{record.} EOS end end |
#assign_later ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 26 def assign_later Resque.enqueue(AssignmentJob, object.pid) end |
#default_metadata ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 58 def { profile: "dc", export: "no" } end |
#record ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 64 def record return @record if @record if object.permanent_id @record = Ezid::Identifier.find(object.permanent_id.to_s) end end |