Sha256: 51d61fa37847e36602b703f615cbbfc28ec6cd75a5e8fc0fa9f0cbf8d3689ba6

Contents?: true

Size: 924 Bytes

Versions: 10

Compression:

Stored size: 924 Bytes

Contents

module Mrkt
  module CrudAssetFolders
    def create_folder(name, parent, description: nil)
      post('/rest/asset/v1/folders.json') do |req|
        params = {
          name: name,
          parent: JSON.generate(parent)
        }

        optional = {
          description: description
        }

        req.body = merge_params(params, optional)
      end
    end

    def get_folder_by_id(id, type: nil)
      params = {}
      params[:type] = type if type

      get("/rest/asset/v1/folder/#{id}.json", params)
    end

    def get_folder_by_name(name, type: nil, root: nil, work_space: nil)
      params = {
        name: name
      }

      optional = {
        root: root&.to_json,
        type: type,
        workSpace: work_space
      }

      get('/rest/asset/v1/folder/byName.json', params, optional)
    end

    def delete_folder(id)
      post("/rest/asset/v1/folder/#{id}/delete.json")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mrkt-1.2.2 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.2.1 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.2.0 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.1.1 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.1.0 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.0.1 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-1.0.0 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-0.11.1 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-0.11.0 lib/mrkt/concerns/crud_asset_folders.rb
mrkt-0.10.0 lib/mrkt/concerns/crud_asset_folders.rb