Module: Mrkt::CrudAssetFolders

Included in:
Client
Defined in:
lib/mrkt/concerns/crud_asset_folders.rb

Instance Method Summary collapse

Instance Method Details

#create_folder(name, parent, description: nil) ⇒ Object


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mrkt/concerns/crud_asset_folders.rb', line 3

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

#delete_folder(id) ⇒ Object


39
40
41
# File 'lib/mrkt/concerns/crud_asset_folders.rb', line 39

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

#get_folder_by_id(id, type: nil) ⇒ Object


18
19
20
21
22
23
# File 'lib/mrkt/concerns/crud_asset_folders.rb', line 18

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

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

#get_folder_by_name(name, type: nil, root: nil, work_space: nil) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mrkt/concerns/crud_asset_folders.rb', line 25

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