Class: Pageflow::Editor::FileImportController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::Editor::FileImportController
- Defined in:
- app/controllers/pageflow/editor/file_import_controller.rb
Overview
This controller handles file import requests and pass them to appropriate file importer
Instance Method Summary collapse
Instance Method Details
#files_meta_data ⇒ Object
13 14 15 16 17 |
# File 'app/controllers/pageflow/editor/file_import_controller.rb', line 13 def result = file_importer.(file_importer_credentials, params.require(:files)) render json: {data: result} end |
#search ⇒ Object
8 9 10 11 |
# File 'app/controllers/pageflow/editor/file_import_controller.rb', line 8 def search result = file_importer.search file_importer_credentials, search_query render json: {data: result} end |
#start_import_job ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/pageflow/editor/file_import_controller.rb', line 19 def start_import_job entry = DraftEntry.find(entry_name) (:edit, entry.to_model) @items = files_params.map do |file_params| file = entry.create_file!(file_type, file_params.except(:url)) file_import = create_file_import(file, file_params) FileImportJob.perform_later(file_import.id, file_importer_credentials) {file: file, source_url: file_params[:url]} end end |