Sha256: 0964647e1b5a3f94ceb121a71e234dba7249501f5db296ba63cad12004b1572a
Contents?: true
Size: 1.81 KB
Versions: 51
Compression:
Stored size: 1.81 KB
Contents
module ZuoraConnect class StaticController < ApplicationController before_action :authenticate_connect_app_request, :except => [:metrics, :health, :initialize_app] before_action :clear_connect_app_session, :only => [:metrics, :health, :initialize_app] after_action :persist_connect_app_session, :except => [:metrics, :health, :initialize_app] skip_before_action :verify_authenticity_token, :only => [:initialize_app] def metrics type = params[:type].present? ? params[:type] : "versions" render json: ZuoraConnect::AppInstance.get_metrics(type).to_json, status: 200 end def health if params[:error].present? begin raise ZuoraConnect::Exceptions::Error.new('This is an error') rescue => ex case params[:error] when 'Log' Rails.logger.error("Error in Health", ex) when 'Exception' raise end end end render json: { message: "Alive", status: 200 }, status: 200 end def initialize_app begin authenticate_connect_app_request @appinstance.new_session(:session => @appinstance.data_lookup(:session => session)) render json: { message: "Success", status: 200 }, status: 200 rescue => ex Rails.logger.error("Failed to Initialize application", ex) if performed? Rails.logger.error("Failed to Initialize application #{performed?}", ex) else render json: { message: "Failure initializing app instance", status: 500 }, status: 500 end end end private def clear_connect_app_session Thread.current[:appinstance] = nil request.session_options[:skip] = true end end end
Version data entries
51 entries across 51 versions & 1 rubygems