Sha256: 1b56bb65e0c5fb21bc1b71601a77416f7cdb762055213dcd022bf2ba7135dc67

Contents?: true

Size: 712 Bytes

Versions: 14

Compression:

Stored size: 712 Bytes

Contents

class IngestLocalFileJob < ActiveJob::Base
  queue_as :ingest_local

  def perform(file_set_id, directory, filename, user_key)
    user = User.find_by_user_key(user_key)
    fail "Unable to find user for #{user_key}" unless user
    file_set = FileSet.find(file_set_id)
    file_set.label ||= filename
    path = File.join(directory, filename)

    actor = CurationConcerns::FileSetActor.new(file_set, user)

    if actor.create_content(File.open(path))
      FileUtils.rm(path)
      CurationConcerns.config.callback.run(:after_import_local_file_success, file_set, user, filename)
    else
      CurationConcerns.config.callback.run(:after_import_local_file_failure, file_set, user, filename)
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
curation_concerns-0.12.0.pre5 app/jobs/ingest_local_file_job.rb
curation_concerns-0.12.0.pre4 app/jobs/ingest_local_file_job.rb
curation_concerns-0.12.0.pre3 app/jobs/ingest_local_file_job.rb
curation_concerns-0.12.0.pre2 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.12.0.pre1 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.11.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.11.0.rc1 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.10.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.9.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.8.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.7.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.6.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.5.0 app/jobs/ingest_local_file_job.rb
curation_concerns-models-0.4.0 app/jobs/ingest_local_file_job.rb