Sha256: d1245d6ec80d32f4d91e3ac48181fbbb365183744da12a49f7c366b75f100dfb
Contents?: true
Size: 752 Bytes
Versions: 4
Compression:
Stored size: 752 Bytes
Contents
# frozen_string_literal: true module TwilioBase class BaseController < ApplicationController before_action :validate_request before_action :force_request_format include ActionController::MimeResponds private def validate_request request_verification_service = TwilioBase::RequestVerificationService.new( Twilio::Security::RequestValidator.new( ENV.fetch('TWILIO_AUTH_TOKEN') ) ) unless request_verification_service.verify( uri: request.original_url, env: request.env ) render head :ok, status: :unauthorized && return end end def force_request_format request.format = :xml unless params[:format] end end end
Version data entries
4 entries across 4 versions & 1 rubygems