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
-
#close_version(**params) ⇒ String
Close current version for an object.
-
#current_version ⇒ String
Get the current_version for a DOR object.
- #files ⇒ Object
-
#initialize(connection:, version:, object_identifier:) ⇒ Object
constructor
A new instance of Object.
-
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR.
-
#open_new_version(**params) ⇒ String
Open new version for an object.
-
#publish ⇒ boolean
Publish a new object.
- #release_tags ⇒ Object
- #sdr ⇒ Object
- #workflow ⇒ Object
- #workspace ⇒ Object
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Object
Returns a new instance of Object.
17 18 19 20 21 22 |
# File 'lib/dor/services/client/object.rb', line 17 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.
14 15 16 |
# File 'lib/dor/services/client/object.rb', line 14 def object_identifier @object_identifier end |
Instance Method Details
#close_version(**params) ⇒ String
Close current version for an object
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/dor/services/client/object.rb', line 101 def close_version(**params) resp = connection.post do |req| req.url close_version_path req.headers['Content-Type'] = 'application/json' req.body = params.to_json if params.any? end return resp.body if resp.success? raise_exception_based_on_response!(resp) end |
#current_version ⇒ String
Get the current_version for a DOR object. This comes from Dor::VersionMetadataDS
74 75 76 77 78 79 80 81 |
# File 'lib/dor/services/client/object.rb', line 74 def current_version resp = connection.get do |req| req.url "#{object_path}/versions/current" end return resp.body if resp.success? raise_exception_based_on_response!(resp) end |
#files ⇒ Object
28 29 30 |
# File 'lib/dor/services/client/object.rb', line 28 def files @files ||= Files.new(connection: connection, version: api_version, object_identifier: object_identifier) end |
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR
61 62 63 64 65 66 67 68 |
# File 'lib/dor/services/client/object.rb', line 61 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 |
#open_new_version(**params) ⇒ String
Open new version for an object
89 90 91 92 93 94 |
# File 'lib/dor/services/client/object.rb', line 89 def open_new_version(**params) version = open_new_version_response(**params) raise MalformedResponse, "Version of #{object_identifier} is empty" if version.empty? version end |
#publish ⇒ boolean
Publish a new object
48 49 50 51 52 53 54 55 |
# File 'lib/dor/services/client/object.rb', line 48 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 |
#release_tags ⇒ Object
40 41 42 |
# File 'lib/dor/services/client/object.rb', line 40 def @release_tags ||= ReleaseTags.new(connection: connection, version: api_version, object_identifier: object_identifier) end |
#sdr ⇒ Object
24 25 26 |
# File 'lib/dor/services/client/object.rb', line 24 def sdr @sdr ||= SDR.new(connection: connection, version: api_version, object_identifier: object_identifier) end |