Class: Dor::Services::Client::Embargo
- Inherits:
-
VersionedService
- Object
- VersionedService
- Dor::Services::Client::Embargo
- Defined in:
- lib/dor/services/client/embargo.rb
Overview
API calls that are about managing embargo on a repository object
Instance Method Summary collapse
-
#initialize(connection:, version:, object_identifier:) ⇒ Embargo
constructor
A new instance of Embargo.
-
#update(embargo_date:, requesting_user:) ⇒ NilClass
When the update is successful.
Constructor Details
#initialize(connection:, version:, object_identifier:) ⇒ Embargo
Returns a new instance of Embargo.
9 10 11 12 |
# File 'lib/dor/services/client/embargo.rb', line 9 def initialize(connection:, version:, object_identifier:) super(connection: connection, version: version) @object_identifier = object_identifier end |
Instance Method Details
#update(embargo_date:, requesting_user:) ⇒ NilClass
Returns when the update is successful.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dor/services/client/embargo.rb', line 23 def update(embargo_date:, requesting_user:) resp = connection.patch do |req| req.url path req.headers['Content-Type'] = 'application/json' req.body = { embargo_date: , requesting_user: requesting_user }.to_json end return if resp.success? raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp, object_identifier: object_identifier) end |