Sha256: 8ed46790dde1e5f39e53fdb29cc6649afb1fee4273920d3bd0a6d878afdea161

Contents?: true

Size: 697 Bytes

Versions: 13

Compression:

Stored size: 697 Bytes

Contents

require 'fiona7/controllers/rest_api/error_handler'

module Fiona7
  class ApiController < ActionController::Base
    def perform
      path    = params[:path].to_s
      verb    = params[:verb].to_s.downcase.to_sym
      payload = params[:params]

      render json: Scrivito::CmsRestApi.task_unaware_request(verb, path, payload)
    rescue *Fiona7::ErrorHandler::HANDLED_ERRORS => e
      message = Fiona7::ErrorHandler.new(e).api_error
      render json: {error: message}, status: 422
    rescue Scrivito::ApplicationError => e
      render json: {error: e.message}, status: e.http_code
    rescue Scrivito::ClientError => e
      render json: {error: e.message}, status: 422
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.5 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.6.1.1.1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.6.1.1.0 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.5.5.1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.5.5.0 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.5.4.1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.5.4.0 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.5.3.1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.4.3.0 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.3.2.0 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 app/controllers/fiona7/api_controller.rb
infopark_fiona7-1.5.2.0.0 app/controllers/fiona7/api_controller.rb