Class: ZuoraConnect::StaticController

Inherits:
ApplicationController show all
Defined in:
app/controllers/zuora_connect/static_controller.rb

Instance Method Summary collapse

Instance Method Details

#healthObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/zuora_connect/static_controller.rb', line 14

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

#initialize_appObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/zuora_connect/static_controller.rb', line 34

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

#metricsObject



9
10
11
12
# File 'app/controllers/zuora_connect/static_controller.rb', line 9

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