Class: SpreeCmCommissioner::ImportedCsvDownloader

Inherits:
BaseInteractor show all
Defined in:
app/interactors/spree_cm_commissioner/imported_csv_downloader.rb

Instance Method Summary collapse

Instance Method Details

#callObject



3
4
5
6
7
8
9
10
11
12
13
# File 'app/interactors/spree_cm_commissioner/imported_csv_downloader.rb', line 3

def call
  import_order = SpreeCmCommissioner::Imports::ImportOrder.find(context.import_order_id)

  if import_order.imported_file.attached?
    context.file_data = import_order.imported_file.download
    context.filename = import_order.imported_file.filename.to_s
    context.content_type = import_order.imported_file.content_type
  else
    context.fail!(error: 'No file attached')
  end
end