Sha256: e07a7e035ae0ebd1f9ae60b26d61851626a9c7b8cf62f3b9e63d821ab693d7a3

Contents?: true

Size: 991 Bytes

Versions: 5

Compression:

Stored size: 991 Bytes

Contents

module Api
  module V1
    class SettingsController < V1::BaseController
      before_filter :require_admin
      before_filter :find_resource, :only => %w{show update}

      api :GET, "/settings/", "List all settings."
      param :search, String, :desc => "Filter results"
      param :order, String, :desc => "Sort results"
      param :page, String, :desc => "paginate results"
      param :per_page, String, :desc => "number of entries per request"

      def index
        @settings = Setting.search_for(*search_options).paginate(paginate_options)
      end

      api :GET, "/settings/:id/", "Show an setting."
      param :id, String, :required => true

      def show
      end

      api :PUT, "/settings/:id/", "Update a setting."
      param :id, String, :required => true
      param :setting, Hash, :required => true do
        param :value, String
      end

      def update
        process_response @setting.update_attributes(params[:setting])
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/app/controllers/api/v1/settings_controller.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/api/v1/settings_controller.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/api/v1/settings_controller.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/api/v1/settings_controller.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/api/v1/settings_controller.rb