Sha256: 79fb92d5b17ea781c84755073fb0c2893413a08fdb41e74d98d7f9c0644de700

Contents?: true

Size: 1.17 KB

Versions: 15

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

15 entries across 15 versions & 1 rubygems

Version Path
redhat_access-2.9.1 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.8.1 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.20 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.19 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.18 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.17 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.16 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.15 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.14 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.13 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.12 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.11 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.10 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.9 app/controllers/redhat_access/telemetry_configurations_controller.rb
redhat_access-2.2.8 app/controllers/redhat_access/telemetry_configurations_controller.rb