Class: Hyrax::Actors::CreateWithRemoteFilesActor
- Inherits:
-
AbstractActor
- Object
- AbstractActor
- Hyrax::Actors::CreateWithRemoteFilesActor
- Defined in:
- app/actors/hyrax/actors/create_with_remote_files_actor.rb
Overview
If there is a key :remote_files
in the attributes, it attaches the files at the specified URIs to the work. e.g.:
attributes[:remote_files] = filenames.map do |name|
{ url: "https://example.com/file/#{name}", file_name: name }
end
Browse everything may also return a local file. And although it’s in the url property, it may have spaces, and not be a valid URI.
Direct Known Subclasses
Defined Under Namespace
Classes: IngestRemoteFilesService
Instance Attribute Summary
Attributes inherited from AbstractActor
Instance Method Summary collapse
-
#create(env) ⇒ Boolean
True if create was successful.
-
#update(env) ⇒ Boolean
True if update was successful.
Methods inherited from AbstractActor
Constructor Details
This class inherits a constructor from Hyrax::Actors::AbstractActor
Instance Method Details
#create(env) ⇒ Boolean
Returns true if create was successful.
15 16 17 18 |
# File 'app/actors/hyrax/actors/create_with_remote_files_actor.rb', line 15 def create(env) remote_files = env.attributes.delete(:remote_files) next_actor.create(env) && attach_files(env, remote_files) end |
#update(env) ⇒ Boolean
Returns true if update was successful.
22 23 24 25 |
# File 'app/actors/hyrax/actors/create_with_remote_files_actor.rb', line 22 def update(env) remote_files = env.attributes.delete(:remote_files) next_actor.update(env) && attach_files(env, remote_files) end |