Module: Agilix::Buzz::Commands::Resource

Included in:
Api
Defined in:
lib/agilix/buzz/commands/resource.rb

Instance Method Summary collapse

Instance Method Details

#copy_resources(items = []) ⇒ Object

api.copy_resources [ {sourceentityid: 57025, destinationentityid: 57031, sourcepath: “banner.css” }]



7
8
9
10
11
12
# File 'lib/agilix/buzz/commands/resource.rb', line 7

def copy_resources(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( sourceentityid destinationentityid ), optional_params: %i( sourcepath destinationpath ), options: item )
  end
  authenticated_bulk_post cmd: "copyresources", root_node: "resource", body: options
end

#delete_documents(items = []) ⇒ Object

api.delete_documents



83
84
85
86
87
88
# File 'lib/agilix/buzz/commands/resource.rb', line 83

def delete_documents(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( ), options: item )
  end
  authenticated_bulk_post cmd: "deletedocuments", root_node: "document", body: options
end

#delete_resources(items = []) ⇒ Object

api.delete_resources [57031, path: ‘banner.css’]



15
16
17
18
19
20
# File 'lib/agilix/buzz/commands/resource.rb', line 15

def delete_resources(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
  end
  authenticated_bulk_post cmd: "deleteresources", root_node: "resource", body: options
end

#get_document(options = {}) ⇒ Object

api.get_document enrollmentid: 60997



91
92
93
94
# File 'lib/agilix/buzz/commands/resource.rb', line 91

def get_document(options = {})
  options = argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( version ), options: options )
  authenticated_get cmd: "getdocument", **options
end

#get_document_info(items = []) ⇒ Object

ISSUE: Why is get command a bulk POST request api.get_document_info



98
99
100
101
102
103
104
# File 'lib/agilix/buzz/commands/resource.rb', line 98

def get_document_info(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( ), options: item )
  end
  authenticated_bulk_post cmd: "getdocumentinfo", root_node: "document", body: options
  authenticated_get cmd: "", **options
end

#get_entity_resource_id(options = {}) ⇒ Object

api.get_entity_resource_id entityid: 57025



23
24
25
26
# File 'lib/agilix/buzz/commands/resource.rb', line 23

def get_entity_resource_id(options = {})
  options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
  authenticated_get cmd: "getentityresourceid", **options
end

#get_resource(options = {}) ⇒ Object

api.get_resource entityid: 57031, path: “banner.css”



29
30
31
32
# File 'lib/agilix/buzz/commands/resource.rb', line 29

def get_resource(options = {})
  options = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( version packagetype attachment class ), options: options )
  authenticated_get cmd: "getresource", **options
end

#get_resource_info2(items = []) ⇒ Object Also known as: get_resource_info

ISSUE: This is a get request with a POST verb. The documentation only suggests getting a single resoure, so I’m not sure why it would be a bulk post syntax. it does seem to respond to multiple resources though,so we’ll adapt api.get_resource_info [57031, path: “banner.css”]



36
37
38
39
40
41
# File 'lib/agilix/buzz/commands/resource.rb', line 36

def get_resource_info2(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
  end
  authenticated_bulk_post cmd: "getresourceinfo2", root_node: "resource", body: options
end

#get_resource_list2(options = {}) ⇒ Object Also known as: get_resource_list

api.get_resource_list2 entityid: 57025



45
46
47
48
# File 'lib/agilix/buzz/commands/resource.rb', line 45

def get_resource_list2(options = {})
  options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( path recurse query allversions entries class ), options: options )
  authenticated_get cmd: "getresourcelist2", **options
end

#list_restorable_documents(options = {}) ⇒ Object

api.list_restorable_documents enrollmentid: 64001



107
108
109
110
# File 'lib/agilix/buzz/commands/resource.rb', line 107

def list_restorable_documents(options = {})
  options = argument_cleaner(required_params: %i( enrollmentid itemid ), optional_params: %i( ), options: options )
  authenticated_get cmd: "listrestorabledocuments", **options
end

#list_restorable_resources(options = {}) ⇒ Object

api.list_restorable_resources entityid: 57025



52
53
54
55
# File 'lib/agilix/buzz/commands/resource.rb', line 52

def list_restorable_resources(options = {})
  options = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: options )
  authenticated_get cmd: "listrestorableresources", **options
end

#put_resource(file, options = {}) ⇒ Object

file_name = “my-file.pdf” file = File.open file_name api.put_resource file, 57025, path: file_name



60
61
62
63
64
# File 'lib/agilix/buzz/commands/resource.rb', line 60

def put_resource(file, options = {})
  options = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( status class drophistory contenttype ), options: options )
  # authenticated_query_post cmd: "putresource", **options
  authenticated_query_post query_params: {cmd: "putresource", **options }, file: file
end

#put_resource_folders(items = []) ⇒ Object

api.put_resource_folders [57031, path: ‘test/folder-1’]



67
68
69
70
71
72
# File 'lib/agilix/buzz/commands/resource.rb', line 67

def put_resource_folders(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( entityid path ), optional_params: %i( ), options: item )
  end
  authenticated_bulk_post cmd: "putresourcefolders", root_node: "folder", body: options
end

#restore_documents(items = []) ⇒ Object

api.restore_documents



114
115
116
117
118
119
# File 'lib/agilix/buzz/commands/resource.rb', line 114

def restore_documents(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i(  enrollmentid itemid path), optional_params: %i( version ), options: item )
  end
  authenticated_bulk_post cmd: "restoredocuments", root_node: "document", body: options
end

#restore_resources(items = []) ⇒ Object

api.restore_resources [57031, path: ‘banner.css’]



75
76
77
78
79
80
# File 'lib/agilix/buzz/commands/resource.rb', line 75

def restore_resources(items = [])
  options = items.map do |item|
    argument_cleaner(required_params: %i( entityid path ), optional_params: %i( class ), options: item )
  end
  authenticated_bulk_post cmd: "restoreresources", root_node: "resource", body: options
end