Module: Agilix::Buzz::Commands::Resource
- Included in:
- Api
- Defined in:
- lib/agilix/buzz/commands/resource.rb
Instance Method Summary collapse
-
#copy_resources(items = []) ⇒ Object
api.copy_resources [ {sourceentityid: 57025, destinationentityid: 57031, sourcepath: “banner.css” }].
-
#delete_documents(items = []) ⇒ Object
api.delete_documents.
-
#delete_resources(items = []) ⇒ Object
api.delete_resources [57031, path: ‘banner.css’].
-
#get_document(options = {}) ⇒ Object
api.get_document enrollmentid: 60997.
-
#get_document_info(items = []) ⇒ Object
ISSUE: Why is get command a bulk POST request api.get_document_info.
-
#get_entity_resource_id(options = {}) ⇒ Object
api.get_entity_resource_id entityid: 57025.
-
#get_resource(options = {}) ⇒ Object
api.get_resource entityid: 57031, path: “banner.css”.
-
#get_resource_info2(items = []) ⇒ Object
(also: #get_resource_info)
ISSUE: This is a get request with a POST verb.
-
#get_resource_list2(options = {}) ⇒ Object
(also: #get_resource_list)
api.get_resource_list2 entityid: 57025.
-
#list_restorable_documents(options = {}) ⇒ Object
api.list_restorable_documents enrollmentid: 64001.
-
#list_restorable_resources(options = {}) ⇒ Object
api.list_restorable_resources entityid: 57025.
-
#put_resource(file, options = {}) ⇒ Object
file_name = “my-file.pdf” file = File.open file_name api.put_resource file, 57025, path: file_name.
-
#put_resource_folders(items = []) ⇒ Object
api.put_resource_folders [57031, path: ‘test/folder-1’].
-
#restore_documents(items = []) ⇒ Object
api.restore_documents.
-
#restore_resources(items = []) ⇒ Object
api.restore_resources [57031, path: ‘banner.css’].
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 = []) = 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: 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 = []) = 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: 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 = []) = 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: 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( = {}) = argument_cleaner(required_params: %i( enrollmentid itemid path ), optional_params: %i( version ), options: ) authenticated_get cmd: "getdocument", ** 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 = []) = 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: authenticated_get cmd: "", ** 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( = {}) = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: ) authenticated_get cmd: "getentityresourceid", ** 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( = {}) = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( version packagetype attachment class ), options: ) authenticated_get cmd: "getresource", ** 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 = []) = 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: 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( = {}) = argument_cleaner(required_params: %i( entityid ), optional_params: %i( path recurse query allversions entries class ), options: ) authenticated_get cmd: "getresourcelist2", ** 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( = {}) = argument_cleaner(required_params: %i( enrollmentid itemid ), optional_params: %i( ), options: ) authenticated_get cmd: "listrestorabledocuments", ** 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( = {}) = argument_cleaner(required_params: %i( entityid ), optional_params: %i( ), options: ) authenticated_get cmd: "listrestorableresources", ** 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, = {}) = argument_cleaner(required_params: %i( entityid path ), optional_params: %i( status class drophistory contenttype ), options: ) # authenticated_query_post cmd: "putresource", **options authenticated_query_post query_params: {cmd: "putresource", ** }, 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 = []) = 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: 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 = []) = 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: 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 = []) = 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: end |