Class: ExportJob

Inherits:
Struct
  • Object
show all
Defined in:
app/jobs/export_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri



1
2
3
# File 'app/jobs/export_job.rb', line 1

def base_uri
  @base_uri
end

#exportObject

Returns the value of attribute export



1
2
3
# File 'app/jobs/export_job.rb', line 1

def export
  @export
end

#filenameObject

Returns the value of attribute filename



1
2
3
# File 'app/jobs/export_job.rb', line 1

def filename
  @filename
end

#typeObject

Returns the value of attribute type



1
2
3
# File 'app/jobs/export_job.rb', line 1

def type
  @type
end

Instance Method Details

#enqueue(job) ⇒ Object



2
3
4
5
6
7
# File 'app/jobs/export_job.rb', line 2

def enqueue(job)
  job.delayed_reference_id   = export.id
  job.delayed_reference_type = export.class.to_s
  job.delayed_global_reference_id = export.to_global_id
  job.save!
end

#error(_job, exception) ⇒ Object



18
19
20
# File 'app/jobs/export_job.rb', line 18

def error(_job, exception)
  export.fail!(exception)
end

#performObject



9
10
11
12
# File 'app/jobs/export_job.rb', line 9

def perform
  exporter = SkosExporter.new(filename, type, base_uri, EntityLogger.new(export))
  exporter.run
end

#success(_job) ⇒ Object



14
15
16
# File 'app/jobs/export_job.rb', line 14

def success(_job)
  export.finish!
end