Sha256: 6c6a71d8517c56af9eb01d530284e5a22bf884d09c62591ba3cc1ed3f087bbf9

Contents?: true

Size: 574 Bytes

Versions: 31

Compression:

Stored size: 574 Bytes

Contents

module InsightsCloud
  class SettingsController < ::ApplicationController
    def show
      render_setting(:insightsSyncEnabled, :allow_auto_insights_sync)
    end

    def update
      Setting[:allow_auto_insights_sync] = settings_params
      render_setting(:insightsSyncEnabled, :allow_auto_insights_sync)
    end

    private

    def render_setting(node_name, setting)
      render json: {
        node_name => Setting[setting],
      }
    end

    def settings_params
      ActiveModel::Type::Boolean.new.cast(params.require(:insightsSyncEnabled))
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
foreman_rh_cloud-1.0.13 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-2.0.13 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-0.9.12 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-1.0.12 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-2.0.12 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-0.9.11 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-1.0.11 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-2.0.11 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-0.9.10 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-1.0.10 app/controllers/insights_cloud/settings_controller.rb
foreman_rh_cloud-2.0.10 app/controllers/insights_cloud/settings_controller.rb