Sha256: 0f35f047f5ce6e1331d07fd6ad55a6587819547867fae40dacf881afa4215b72

Contents?: true

Size: 1.17 KB

Versions: 36

Compression:

Stored size: 1.17 KB

Contents

require_dependency "redhat_access/application_controller"

module RedhatAccess
  class TelemetryConfigurationsController < ApplicationController
    include RedhatAccess::Telemetry::LookUps
    def show
       #TODO require current ORG
      conf = get_telemetry_config(Organization.current)
      render json:  conf.to_json(:except => [ :id, :created_at, :portal_password ,:updated_at])
    end

    def update
      #TODO require current ORG
      conf = get_telemetry_config(Organization.current)
      if conf
        begin
          if conf.update_attributes(telemetry_configuration_params)
          render json: {:message => "config updated"}
        else
          render json: {:error=>"Invalid parameters"}.to_json, status: 400
        end
          rescue=>e
          Rails.logger.info(e)
          render json: {:error=>"Error processing update"}.to_json, status: 500
        end
      else
        render json: {:error=>"Configurationnotfound"}.to_json, status: 404
      end
    end

    private

    def telemetry_configuration_params
      params.require(:telemetry_configuration).permit(:enable_telemetry, :portal_password, :portal_user, :organization_id, :email)
    end

  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
redhat_access-2.2.7 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.10 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.0.17 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.0.16 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.9 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.6 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.0.15 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.8 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.5 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.4 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.3 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.0.14 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.7 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.2 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.0 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.6 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.5 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.4 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.3 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.1.2 app/controllers/redhat_access/telemetry_configurations_controller.rb