Sha256: 742330fb0b2d6fe77197e50781636580bc22649af5cddcd3aee3ac19b99469bd

Contents?: true

Size: 971 Bytes

Versions: 3

Compression:

Stored size: 971 Bytes

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

    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

3 entries across 3 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.9.4 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-6.9.3.1.36404185 app/controllers/rails_connector/workspaces_controller.rb
infopark_cloud_connector-6.9.2.1.125136549 app/controllers/rails_connector/workspaces_controller.rb