Sha256: 59005750c79bcba818bf071f863536106c6bfca548433fb5ae13c50e2f821121

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

module RailsConnector

  class WorkspacesController < WebserviceController
    def index
      render json: CmsRestApi.task_unaware_request(:get, 'workspaces')
    end

    def create
      render json: CmsRestApi.task_unaware_request(:post, 'workspaces', {
        workspace: workspace_params,
      })
    end

    def update
      render json: CmsRestApi.task_unaware_request(:put, "workspaces/#{params[:id]}", {
        workspace: workspace_params,
      })
    end

    def destroy
      render json: CmsRestApi.task_unaware_request(:delete, "workspaces/#{params[:id]}")
    end

    def publish
      render json: CmsRestApi.task_unaware_request(:put, "workspaces/#{params[:id]}/publish", {})
    end

    def rebase
      render json: CmsRestApi.task_unaware_request(:put, "workspaces/#{params[:id]}/rebase", {})
    end

    private

    def workspace_params
      raise "Required parameter 'workspace' is missing." unless params[:workspace].present?
      raise "Parameter 'workspace' is not a hash." unless params[:workspace].is_a?(Hash)
      params[:workspace]
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
infopark_cloud_connector-7.1.0 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-7.0.2 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-7.0.1 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-7.0.0 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-6.9.5 app/controllers/rails_connector/workspaces_controller.rb