class VLibras::RequestsController < ApplicationController protect_from_forgery with: :null_session, :only => [ :callback ] before_filter :check_vlibras_api_status, :only => [ :rapid, :create ] def rapid @request = VLibras::Request.new end def create @request = VLibras::Request.build_from_params(params, current_user) video = FileUploader.new video.cache!(params[:video]) subtitle = FileUploader.new subtitle.cache!(params[:subtitle]) files = { :video => video, :subtitle => subtitle } if @request.save @request.perform_request(files) flash[:success] = 'Sua requisição foi submetida com sucesso!' redirect_to v_libras_videos_path else flash[:error] = 'Algo deu errado com a sua requisição.' render :action => :rapid end end def callback ApiClient::CallbackProcessor.process(params) render :text => "OK!" end end