Class: AttachFilesToWorkWithOrderedMembersJob

Inherits:
AttachFilesToWorkJob show all
Defined in:
app/jobs/attach_files_to_work_with_ordered_members_job.rb

Overview

Converts UploadedFiles into FileSets and attaches them to works.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ordered_membersObject (readonly)

Returns the value of attribute ordered_members


4
5
6
# File 'app/jobs/attach_files_to_work_with_ordered_members_job.rb', line 4

def ordered_members
  @ordered_members
end

#uploaded_filesObject (readonly)

Returns the value of attribute uploaded_files


4
5
6
# File 'app/jobs/attach_files_to_work_with_ordered_members_job.rb', line 4

def uploaded_files
  @uploaded_files
end

Instance Method Details

#perform(work, uploaded_files, **work_attributes) ⇒ Object

Parameters:


8
9
10
11
12
13
14
15
16
17
# File 'app/jobs/attach_files_to_work_with_ordered_members_job.rb', line 8

def perform(work, uploaded_files, **work_attributes)
  @uploaded_files = uploaded_files
  validate_files!(uploaded_files)
  @ordered_members = work.ordered_members.to_a # Build array of ordered members
  depositor = proxy_or_depositor(work)
  user = User.find_by_user_key(depositor)
   = visibility_attributes(work_attributes)
  add_uploaded_files(user, , work)
  add_ordered_members(user, work)
end