Sha256: 9bce285ab0cf924d9c34d5f32ebf76f5755b75cb59881f9b571db6109a850892

Contents?: true

Size: 1.18 KB

Versions: 99

Compression:

Stored size: 1.18 KB

Contents

require_dependency "avo/application_controller"

module Avo
  class DebugController < ApplicationController
    def status
    end

    def send_to_hq
      url = "#{ENV["HQ_URL"]}/api/v3/debug_requests"
      timeout = 10 # seconds
      license_key = Avo::Services::DebugService.debug_report(request)[:hq_payload][:license_key]
      body = params[:body]
      body = {license_key: license_key, body: body, payload: Avo::Services::DebugService.debug_report(request).to_json}.to_json

      HTTParty.post url, body: body, headers: {"Content-Type": "application/json"}, timeout: timeout

      render turbo_stream: turbo_stream.replace(:send_to_hq, plain: "Payload sent to Avo HQ.")
    end

    def report
    end

    def refresh_license
      license = Licensing::LicenseManager.refresh_license request

      if license.valid?
        flash[:notice] = "avohq.io responded: \"#{license.id.humanize} license is valid\"."
      elsif license.response["reason"].present?
        flash[:error] = "avohq.io responded: \"#{license.response["reason"]}\"."
      else
        flash[:error] = license.response["error"]
      end

      redirect_back fallback_location: avo.avo_private_status_path
    end
  end
end

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
avo-3.10.2 app/controllers/avo/debug_controller.rb
avo-3.10.1 app/controllers/avo/debug_controller.rb
avo-3.10.0 app/controllers/avo/debug_controller.rb
avo-3.9.2 app/controllers/avo/debug_controller.rb
avo-3.9.1 app/controllers/avo/debug_controller.rb
avo-3.8.2 app/controllers/avo/debug_controller.rb
avo-3.9.0 app/controllers/avo/debug_controller.rb
avo-3.8.1 app/controllers/avo/debug_controller.rb
avo-3.8.0 app/controllers/avo/debug_controller.rb
avo-3.6.4 app/controllers/avo/debug_controller.rb
avo-3.6.3 app/controllers/avo/debug_controller.rb
avo-3.6.2 app/controllers/avo/debug_controller.rb
avo-3.6.1 app/controllers/avo/debug_controller.rb
avo-3.6.0 app/controllers/avo/debug_controller.rb
avo-3.5.8 app/controllers/avo/debug_controller.rb
avo-3.5.7 app/controllers/avo/debug_controller.rb
avo-3.5.6 app/controllers/avo/debug_controller.rb
avo-3.5.6.beta1 app/controllers/avo/debug_controller.rb
avo-3.5.5 app/controllers/avo/debug_controller.rb
avo-3.5.4 app/controllers/avo/debug_controller.rb