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/"
- 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.
19 20 21 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 19 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.
17 18 19 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 17 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.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 27 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.
23 24 25 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 23 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.
55 56 57 58 59 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 55 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.
61 62 63 64 65 66 |
# File 'lib/ddr/managers/permanent_id_manager.rb', line 61 def record return @record if @record if object.permanent_id @record = Ezid::Identifier.find(object.permanent_id.to_s) end end |