Class: SdrClient::Deposit::UpdateResource
- Inherits:
-
Object
- Object
- SdrClient::Deposit::UpdateResource
- Defined in:
- lib/sdr_client/deposit/update_resource.rb
Overview
Updates a resource (metadata) in SDR
Constant Summary collapse
- DRO_PATH =
'/v1/resources/%<id>s'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metadata:, logger:, connection:, version_description: nil, user_versions: nil) ⇒ UpdateResource
constructor
A new instance of UpdateResource.
-
#run ⇒ String
Job id for the background job result.
Constructor Details
#initialize(metadata:, logger:, connection:, version_description: nil, user_versions: nil) ⇒ UpdateResource
Returns a new instance of UpdateResource.
17 18 19 20 21 22 23 |
# File 'lib/sdr_client/deposit/update_resource.rb', line 17 def initialize(metadata:, logger:, connection:, version_description: nil, user_versions: nil) @metadata = @logger = logger @connection = connection @version_description = version_description @user_versions = user_versions end |
Class Method Details
.run ⇒ Object
9 10 11 |
# File 'lib/sdr_client/deposit/update_resource.rb', line 9 def self.run(...) new(...).run end |
Instance Method Details
#run ⇒ String
Returns job id for the background job result.
27 28 29 30 31 32 33 34 |
# File 'lib/sdr_client/deposit/update_resource.rb', line 27 def run response = UnexpectedResponse.call(response) unless response.status == 202 logger.info("Response from server: #{response.body}") JSON.parse(response.body)['jobId'] end |