Class: Dor::Services::Client::Object
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::Object
- Defined in:
- lib/dor/services/client/object.rb
Overview
API calls that are about a repository object
Instance Attribute Summary collapse
-
#object_identifier ⇒ Object
readonly
Returns the value of attribute object_identifier.
Instance Method Summary collapse
-
#collections ⇒ Array<Cocina::Models::DRO>
Get a list of the collections.
- #embargo ⇒ Object
- #files ⇒ Object
-
#find ⇒ Cocina::Models::DRO, ...
Retrieves the Cocina model.
-
#initialize(connection:, version:, object_identifier:) ⇒ Object
constructor
A new instance of Object.
- #metadata ⇒ Object
-
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR.
-
#publish ⇒ boolean
Publish an object (send to PURL).
-
#refresh_metadata ⇒ boolean
Pull in metadata from Symphony and update descMetadata.
- #release_tags ⇒ Object
- #sdr ⇒ Object
-
#shelve ⇒ boolean
Shelve an object (send to Stacks).
-
#update_marc_record ⇒ boolean
Update the marc record for the given object.
- #version ⇒ Object
- #workspace ⇒ Object
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Object
Returns a new instance of Object.
11 12 13 14 15 16 |
# File 'lib/dor/services/client/object.rb', line 11 def initialize(connection:, version:, object_identifier:) raise ArgumentError, "The `object_identifier` parameter must be an identifier string: #{object_identifier.inspect}" unless object_identifier.is_a?(String) super(connection: connection, version: version) @object_identifier = object_identifier end |
Instance Attribute Details
#object_identifier ⇒ Object (readonly)
Returns the value of attribute object_identifier.
8 9 10 |
# File 'lib/dor/services/client/object.rb', line 8 def object_identifier @object_identifier end |
Instance Method Details
#collections ⇒ Array<Cocina::Models::DRO>
Get a list of the collections. (Similar to Valkyrie’s find_inverse_references_by)
63 64 65 |
# File 'lib/dor/services/client/object.rb', line 63 def collections Collections.new(parent_params).collections end |
#embargo ⇒ Object
42 43 44 |
# File 'lib/dor/services/client/object.rb', line 42 def @embargo ||= Embargo.new(parent_params) end |
#files ⇒ Object
26 27 28 |
# File 'lib/dor/services/client/object.rb', line 26 def files @files ||= Files.new(parent_params) end |
#find ⇒ Cocina::Models::DRO, ...
Retrieves the Cocina model
50 51 52 53 54 55 56 57 58 |
# File 'lib/dor/services/client/object.rb', line 50 def find resp = connection.get do |req| req.url object_path end return Cocina::Models.build(JSON.parse(resp.body)) if resp.success? raise_exception_based_on_response!(resp) end |
#metadata ⇒ Object
22 23 24 |
# File 'lib/dor/services/client/object.rb', line 22 def @metadata ||= Metadata.new(parent_params) end |
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR
123 124 125 126 127 128 129 130 |
# File 'lib/dor/services/client/object.rb', line 123 def notify_goobi resp = connection.post do |req| req.url "#{object_path}/notify_goobi" end return true if resp.success? raise_exception_based_on_response!(resp) end |
#publish ⇒ boolean
Publish an object (send to PURL)
71 72 73 74 75 76 77 78 |
# File 'lib/dor/services/client/object.rb', line 71 def publish resp = connection.post do |req| req.url "#{object_path}/publish" end return true if resp.success? raise_exception_based_on_response!(resp) end |
#refresh_metadata ⇒ boolean
Pull in metadata from Symphony and update descMetadata
110 111 112 113 114 115 116 117 |
# File 'lib/dor/services/client/object.rb', line 110 def resp = connection.post do |req| req.url "#{object_path}/refresh_metadata" end return true if resp.success? raise_exception_based_on_response!(resp) end |
#release_tags ⇒ Object
34 35 36 |
# File 'lib/dor/services/client/object.rb', line 34 def @release_tags ||= ReleaseTags.new(parent_params) end |
#sdr ⇒ Object
18 19 20 |
# File 'lib/dor/services/client/object.rb', line 18 def sdr @sdr ||= SDR.new(parent_params) end |
#shelve ⇒ boolean
Shelve an object (send to Stacks)
84 85 86 87 88 89 90 91 |
# File 'lib/dor/services/client/object.rb', line 84 def shelve resp = connection.post do |req| req.url "#{object_path}/shelve" end return true if resp.success? raise_exception_based_on_response!(resp) end |
#update_marc_record ⇒ boolean
Update the marc record for the given object
97 98 99 100 101 102 103 104 |
# File 'lib/dor/services/client/object.rb', line 97 def update_marc_record resp = connection.post do |req| req.url "#{object_path}/update_marc_record" end return true if resp.success? raise_exception_based_on_response!(resp) end |
#version ⇒ Object
38 39 40 |
# File 'lib/dor/services/client/object.rb', line 38 def version @version ||= ObjectVersion.new(parent_params) end |