Class: Hyrax::Transactions::Steps::SaveCollectionBanner

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/transactions/steps/save_collection_banner.rb

Overview

Adds banner info via ‘ChangeSet`.

During the update collection process this step is called to update the file to be used as a the banner for the collection.

Since:

  • 2.4.0

Instance Method Summary collapse

Instance Method Details

#call(collection_resource, update_banner_file_ids: nil, banner_unchanged_indicator: true) ⇒ Dry::Monads::Result

Returns ‘Failure` if the banner info fails to save; `Success(input)`, otherwise.

Parameters:

  • change_set (Hyrax::ChangeSet)
  • update_banner_file_ids (Array<Integer>) (defaults to: nil)
  • banner_unchanged_indicator (Boolean) (defaults to: true)

Returns:

  • (Dry::Monads::Result)

    ‘Failure` if the banner info fails to save; `Success(input)`, otherwise.

Since:

  • 2.4.0



21
22
23
24
25
26
# File 'lib/hyrax/transactions/steps/save_collection_banner.rb', line 21

def call(collection_resource, update_banner_file_ids: nil, banner_unchanged_indicator: true)
  return Success(collection_resource) if ActiveModel::Type::Boolean.new.cast(banner_unchanged_indicator)
  collection_id = collection_resource.id.to_s
  process_banner_input(collection_id: collection_id, update_banner_file_ids: update_banner_file_ids)
  Success(collection_resource)
end