Class: PurlFetcher::Client::PublishShelve
- Inherits:
-
Object
- Object
- PurlFetcher::Client::PublishShelve
- Defined in:
- lib/purl_fetcher/client/publish_shelve.rb
Overview
High-level client for publishing and shelving.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cocina:, filepath_map:) ⇒ PublishShelve
constructor
A new instance of PublishShelve.
- #publish_and_shelve ⇒ Object
Constructor Details
#initialize(cocina:, filepath_map:) ⇒ PublishShelve
Returns a new instance of PublishShelve.
13 14 15 16 |
# File 'lib/purl_fetcher/client/publish_shelve.rb', line 13 def initialize(cocina:, filepath_map:) @cocina = cocina @filepath_map = filepath_map end |
Class Method Details
.publish_and_shelve ⇒ Object
7 8 9 |
# File 'lib/purl_fetcher/client/publish_shelve.rb', line 7 def self.publish_and_shelve(...) new(...).publish_and_shelve end |
Instance Method Details
#publish_and_shelve ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/purl_fetcher/client/publish_shelve.rb', line 18 def publish_and_shelve logger.debug("Starting publish and shelve for: #{cocina.externalIdentifier}") direct_upload_responses = PurlFetcher::Client::UploadFiles.upload(file_metadata: , filepath_map: filepath_map) file_uploads = direct_upload_responses.map { |response| [ response.filename, response.signed_id ] }.to_h PurlFetcher::Client::Publish.publish(cocina: cocina, file_uploads: file_uploads) logger.debug("Publish and shelve complete") end |