Class: Scribo::Api::SitesController

Inherits:
Scribo::ApplicationController show all
Defined in:
app/controllers/scribo/api/sites_controller.rb

Instance Method Summary collapse

Instance Method Details

#importObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/scribo/api/sites_controller.rb', line 9

def import
  sgid = request.authorization&.split&.last
  head(400) && return unless sgid

  scribable = ::GlobalID::Locator.locate_signed(sgid, for: 'scribo')

  head(401) && return unless scribable

  params[:files].each do |file|
    Scribo::SiteImportService.new(file.path, scribable: scribable).call
  end
end