Sha256: 58e8fe74633bad7e4fd623131ac9c93ae166868e68f44f8d91ba27a2136cca91

Contents?: true

Size: 1.7 KB

Versions: 32

Compression:

Stored size: 1.7 KB

Contents

module ZuoraConnect
  class StaticController < ApplicationController
    before_filter :authenticate_connect_app_request, :except => [:metrics, :health, :session_error, :invalid_app_instance_error, :initialize_app]
    before_filter :clear_connect_app_session,        :only =>   [:metrics, :health, :session_error, :invalid_app_instance_error, :initialize_app]
    after_filter :persist_connect_app_session,       :except => [:metrics, :health, :session_error, :invalid_app_instance_error, :initialize_app]
    
    skip_before_filter :verify_authenticity_token, :only => [:initialize_app]

    def session_error
      respond_to do |format|
        format.html
        format.json { render json: { message: "Session Error", status: 500 }, status: 500 }
      end
    end

    def invalid_app_instance_error
      respond_to do |format|
        format.html
        format.json {render json: { message: "Invalid App Instance", status: 500 }, status: 500 }
      end
    end

    def metrics
      type = params[:type].present? ? params[:type] : "versions"
      render json: ZuoraConnect::AppInstance.get_metrics(type).to_json, status: 200
    end

    def health
      render json: {
        message: "Alive",
        status: 200
      }, status: 200
    end

    def initialize_app
      begin
        authenticate_connect_app_request
        render json: {
          message: "Success",
          status: 200
        }, status: 200
      rescue
        render json: {
          message: "Failure initializing app instance",
          status: 400
        }, status: 400
      end
    end

    private

    def clear_connect_app_session
      Thread.current[:appinstance] = nil
      request.session_options[:skip] = true
    end

  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
zuora_connect-1.7.711 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.710 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.71 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.70 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.69 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.68 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.67 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.66 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.65 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.64 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.63 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.62 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.61 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.60 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.59 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.58 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.57 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.56 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.55 app/controllers/zuora_connect/static_controller.rb
zuora_connect-1.7.54 app/controllers/zuora_connect/static_controller.rb