Class: BulkOps::VerificationJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/bulk_ops/verification_job.rb

Overview

require ‘hydra/access_controls’ require ‘hyrax/workflow/activate_object’

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#operationObject

Returns the value of attribute operation.



6
7
8
# File 'lib/bulk_ops/verification_job.rb', line 6

def operation
  @operation
end

Instance Method Details

#perform(operation_id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bulk_ops/verification_job.rb', line 10

def perform(operation_id)
  operation = BulkOps::Operation.find(operation_id)
  if operation.verify
    operation.set_stage "authorize"
    if operation.create_pull_request
      operation.notify(subject: "Bulk Operation Verification Successful", message: "Your bulk ingest has passed verification, and we have requested to start applying the operation. It may required one final approval from an administrator before the operation proceeds.")
    else
      operation.notify(subject: "Bulk Operation - Error creating Github pull request", message: "Your bulk ingest has passed verification, but we had a problem creating a pull request on Github in order to merge this operation with the master branch. Please check your github configuration.")
    end
  else
    operation.set_stage "pending"
  end
end