Reworked functionality for removing content from collection.
authorFuad Muhic <fmuhic@capeannenterprises.com>
Fri, 12 Jan 2018 13:09:51 +0000 (14:09 +0100)
committerFuad Muhic <fmuhic@capeannenterprises.com>
Fri, 12 Jan 2018 13:09:51 +0000 (14:09 +0100)
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic@capeannenterprises.com>

sdk/R/R/Subcollection.R
sdk/R/README
sdk/R/tests/testthat/test-Arvados.R

index 06df7c48767280f601dcbd30ceec9558adfccdd5..298ab108d98529918e41ea832928cb826a999016 100644 (file)
@@ -63,7 +63,8 @@ Subcollection <- R6::R6Class(
             else
             {
                 stop(paste("Expected AravodsFile or Subcollection object, got",
-                           class(content), "."))
+                           paste0("(", paste0(class(content), collapse = ", "), ")"),
+                           "."))
             }
         },
 
@@ -90,7 +91,9 @@ Subcollection <- R6::R6Class(
             }
             else
             {
-                stop(paste("Expected character, got", class(content), "."))
+                stop(paste("Expected character, got",
+                           paste0("(", paste0(class(name), collapse = ", "), ")"),
+                           "."))
             }
         },
 
index 7f984fe6f9f8a0b9262db3def73cdd0ab80259eb..5ef9620102cdc9903e74a549b9dcf0db656c2b73 100644 (file)
@@ -154,19 +154,26 @@ arvadosFile$write("This is new file content")
 
 file <- collection$get("location/to/my/file.cpp")
 
-file$removeFromCollection()
+collection$remove(file)
 
 #Or
 
-collection$remove(file)
+collection$remove("location/to/my/file.cpp")
 
 #Both examples will remove file "file.cpp" from a collection
+#You can remove both Subcollection and ArvadosFile
 #If subcollection contains more files or folders they will be removed recursively.
 
 #You can also remove multiple files
 
 collection$remove(c("path/to/my/file.cpp", "path/to/other/file.cpp"))
 
+#Delete file or folder from a Subcollection
+
+subcollection <- collection$get("mySubcollection/")
+subcollection$remove("fileInsideSubcollection.exe")
+subcollection$remove("folderInsideSubcollection/")
+
 --------------------------------------------------------------------------------------------------------------------------------
 
 #Move file or folder inside collection
index 950c545aa545b8222bbcdf2c74100e8709d418fc..ef82b3d0ef8f026051d929aaaa153d639a29d7b5 100644 (file)
@@ -42,7 +42,7 @@ test_that("Constructor raises exception if fields and environment variables are
     expect_that(Arvados$new(),
                 throws_error(paste0("Please provide host name and authentification token",
                                     " or set ARVADOS_API_HOST and ARVADOS_API_TOKEN",
-                                    " environmental variables.")))
+                                    " environment variables.")))
 }) 
 
 test_that("getWebDavHostName calls REST service properly", {