Sha256: 2474aa64d8ee59c60fa1e48c0e6dbab2ad8ba0a9a5a7c1e718d4cd632706020b

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

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

      api :GET, "/ptables/", "List all ptables."
      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
        @ptables = Ptable.search_for(*search_options).paginate(paginate_options)
      end

      api :GET, "/ptables/:id/", "Show a ptable."
      param :id, :identifier, :required => true

      def show
      end

      api :POST, "/ptables/", "Create a ptable."
      param :ptable, Hash, :required => true do
        param :name, String, :required => true
        param :layout, String, :required => true
        param :os_family, String, :required => false
      end

      def create
        @ptable = Ptable.new(params[:ptable])
        process_response @ptable.save
      end

      api :PUT, "/ptables/:id/", "Update a ptable."
      param :id, String, :required => true
      param :ptable, Hash, :required => true do
        param :name, String
        param :layout, String
        param :os_family, String
      end

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

      api :DELETE, "/ptables/:id/", "Delete a ptable."
      param :id, String, :required => true

      def destroy
        process_response @ptable.destroy
      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/ptables_controller.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/app/controllers/api/v1/ptables_controller.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/app/controllers/api/v1/ptables_controller.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/app/controllers/api/v1/ptables_controller.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/app/controllers/api/v1/ptables_controller.rb