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 Method Summary collapse
-
#current_version ⇒ String
Get the current_version for a DOR object.
-
#initialize(connection:, version:, object:) ⇒ Object
constructor
A new instance of Object.
-
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR.
-
#publish ⇒ boolean
Publish a new object.
Constructor Details
#initialize(connection:, version:, object:) ⇒ Object
Returns a new instance of Object.
12 13 14 15 |
# File 'lib/dor/services/client/object.rb', line 12 def initialize(connection:, version:, object:) super(connection: connection, version: version) @object = object end |
Instance Method Details
#current_version ⇒ String
Get the current_version for a DOR object. This comes from Dor::VersionMetadataDS
44 45 46 47 48 49 50 51 |
# File 'lib/dor/services/client/object.rb', line 44 def current_version resp = connection.get do |req| req.url "#{object_path}/versions/current" end raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success? resp.body end |
#notify_goobi ⇒ boolean
Notify the external Goobi system for a new object that was registered in DOR
32 33 34 35 36 37 38 39 |
# File 'lib/dor/services/client/object.rb', line 32 def notify_goobi resp = connection.post do |req| req.url "#{object_path}/notify_goobi" end raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success? true end |
#publish ⇒ boolean
Publish a new object
20 21 22 23 24 25 26 27 |
# File 'lib/dor/services/client/object.rb', line 20 def publish resp = connection.post do |req| req.url "#{api_version}/objects/#{object}/publish" end raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body})" unless resp.success? true end |