Class: Hyrax::Transactions::Steps::ApplyVisibility Deprecated
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::ApplyVisibility
- Includes:
- Dry::Transaction::Operation
- Defined in:
- lib/hyrax/transactions/steps/apply_visibility.rb
Overview
Deprecated.
This is part of the legacy AF set of transaction steps for works. Transactions are not being used with AF works. This will be removed in 4.0.
A ‘dry-transaction` step that interprets visibility/lease/embargo from passed arguments.
Instance Method Summary collapse
-
#call(work, visibility: nil, release_date: nil, during: nil, after: nil) ⇒ Dry::Monads::Result
‘Failure` if there is no `PermissionTemplate` for the input; `Success(input)`, otherwise.
Instance Method Details
#call(work, visibility: nil, release_date: nil, during: nil, after: nil) ⇒ Dry::Monads::Result
Returns ‘Failure` if there is no `PermissionTemplate` for the input; `Success(input)`, otherwise.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hyrax/transactions/steps/apply_visibility.rb', line 24 def call(work, visibility: nil, release_date: nil, during: nil, after: nil) return Success(work) if visibility.blank? intention = Hyrax::VisibilityIntention.new(visibility: visibility, release_date: release_date, during: during, after: after) Hyrax::VisibilityIntentionApplicator.apply(intention).to(model: work) Success(work) rescue Hyrax::VisibilityIntentionApplicator::InvalidIntentionError => err Failure(err) end |