Class: ImportUrlJob
- Inherits:
-
Hyrax::ApplicationJob
- Object
- ApplicationJob
- Hyrax::ApplicationJob
- ImportUrlJob
- Defined in:
- app/jobs/import_url_job.rb
Overview
this is commonly called during deposit by AttachFilesToWorkJob (when files are uploaded directly as Hyrax::UploadedFile) and Hyrax::Actors::CreateWithRemoteFilesActor when files are located in some other service.
Given a FileSet that has an #import_url
property, download that file and deposit into Fedora.
Instance Attribute Summary collapse
-
#file_set ⇒ Object
readonly
Returns the value of attribute file_set.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#file_set ⇒ Object (readonly)
Returns the value of attribute file_set.
16 17 18 |
# File 'app/jobs/import_url_job.rb', line 16 def file_set @file_set end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
16 17 18 |
# File 'app/jobs/import_url_job.rb', line 16 def headers @headers end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
16 17 18 |
# File 'app/jobs/import_url_job.rb', line 16 def operation @operation end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
16 17 18 |
# File 'app/jobs/import_url_job.rb', line 16 def uri @uri end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
16 17 18 |
# File 'app/jobs/import_url_job.rb', line 16 def user @user end |
Instance Method Details
#perform(file_set, operation, headers = {}, use_valkyrie: false) ⇒ Object
At present, this job works for ActiveFedora objects. The use_valkyrie is not complete.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/jobs/import_url_job.rb', line 30 def perform(file_set, operation, headers = {}, use_valkyrie: false) @file_set = file_set @operation = operation @headers = headers operation.performing! @user = User.find_by_user_key(file_set.depositor) @uri = URI(file_set.import_url) return false unless can_retrieve_remote? if use_valkyrie # TODO else perform_af end end |