Class: BulkImports::ExportService
- Inherits:
-
Object
- Object
- BulkImports::ExportService
- Defined in:
- app/services/bulk_imports/export_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(portable:, user:, batched: false) ⇒ ExportService
constructor
A new instance of ExportService.
Constructor Details
#initialize(portable:, user:, batched: false) ⇒ ExportService
Returns a new instance of ExportService.
8 9 10 11 12 |
# File 'app/services/bulk_imports/export_service.rb', line 8 def initialize(portable:, user:, batched: false) @portable = portable @current_user = user @batched = batched end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/services/bulk_imports/export_service.rb', line 14 def execute FileTransfer.config_for(portable).portable_relations.each do |relation| RelationExportWorker.perform_async(current_user.id, portable.id, portable.class.name, relation, batched) end ServiceResponse.success rescue StandardError => e ServiceResponse.error( message: e.class, http_status: :unprocessable_entity ) end |