Sha256: 02a0d2bb4453a9e55ba20cab7859d02bc8eb843565efc37d1a7f6e241684a75f

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true
class TPHealthcheck::CheckController < ApplicationController
  include TPHealthcheck::DataBaseHelper

  def show
    unless self.class.private_method_defined?(params[:cmd].to_sym)
      return render json: { url: 'url not found' }.to_json, status: :not_found
    end
    send(params[:cmd])
  end

  private

  def ping
    render plain: Rails.application.class.parent, status: :ok
  end

  def database
    unless database_on?
      return render json: { code: '01', msg: 'database error' }.json, status: :internal_server_error
    end
    render plain: 'OK', status: :ok
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tp_healthcheck-0.1.0 app/controllers/tp_healthcheck/check_controller.rb