Class: Hyrax::Actors::DOIActor

Inherits:
AbstractActor
  • Object
show all
Defined in:
app/actors/hyrax/actors/doi_actor.rb

Overview

An actor that registers a DOI using the configured registar This actor should come after the model actor which saves the work

Examples:

use in middleware

stack = ActionDispatch::MiddlewareStack.new.tap do |middleware|
  # middleware.use OtherMiddleware
  middleware.use Hyrax::Actors::DOIActor
  # middleware.use MoreMiddleware
end

env = Hyrax::Actors::Environment.new(object, ability, attributes)
last_actor = Hyrax::Actors::Terminator.new
stack.build(last_actor).create(env)

Instance Method Summary collapse

Instance Method Details

#create(env) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • AbstractActor


23
24
25
26
# File 'app/actors/hyrax/actors/doi_actor.rb', line 23

def create(env)
  # Assume the model actor has already run and saved the work
  create_or_update_doi(env.curation_concern) && next_actor.create(env)
end

#update(env) ⇒ Boolean

Returns:

  • (Boolean)

See Also:

  • AbstractActor


32
33
34
# File 'app/actors/hyrax/actors/doi_actor.rb', line 32

def update(env)
  create_or_update_doi(env.curation_concern) && next_actor.update(env)
end