Class: ExportJob
- Inherits:
-
Struct
- Object
- Struct
- ExportJob
- Defined in:
- app/jobs/export_job.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#export ⇒ Object
Returns the value of attribute export.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri
1 2 3 |
# File 'app/jobs/export_job.rb', line 1 def base_uri @base_uri end |
#export ⇒ Object
Returns the value of attribute export
1 2 3 |
# File 'app/jobs/export_job.rb', line 1 def export @export end |
#filename ⇒ Object
Returns the value of attribute filename
1 2 3 |
# File 'app/jobs/export_job.rb', line 1 def filename @filename end |
#type ⇒ Object
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
21 22 23 |
# File 'app/jobs/export_job.rb', line 21 def error(job, exception) export.fail!(exception) end |
#perform ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/jobs/export_job.rb', line 9 def perform strio = StringIO.new exporter = SkosExporter.new(filename, type, base_uri, Logger.new(strio)) exporter.run @messages = strio.string end |
#success(job) ⇒ Object
17 18 19 |
# File 'app/jobs/export_job.rb', line 17 def success(job) export.finish!(@messages) end |