DataONEorg / rdataone

R package for reading and writing data at DataONE data repositories
http://doi.org/10.5063/F1M61H5X
36 stars 19 forks source link

Added destination path & unzip to `getPackage` arguments #212

Closed isteves closed 6 years ago

isteves commented 6 years ago

Now if you specify a directory path, the zip file will be saved directly to the path specified (in this case, the current working directory), rather than to a temp folder.

cn <- dataone::CNode("PROD")
mn <- dataone::getMNode(cn, "urn:node:ARCTIC")
getPackage(mn, "resource_map_doi:10.18739/A2MQ00", dirPath = ".")

If you specify unzip = TRUE, the package will be automatically unzipped.

getPackage(mn, "resource_map_doi:10.18739/A2MQ00", dirPath = ".", unzip = TRUE)

@gothub

gothub commented 6 years ago

This looks fine - the method works as before if the default arguments for 'dirPath' and 'unzip' are used, i.e. backward compatibility is maintained. Also, if values are specified for the new args, they both work as documented.

mbjones commented 6 years ago

@isteves Looks like a great feature. I don't see any new tests in the tests directory confirming that these new features work. Could you add those please, or point them out to me if I missed them? Thanks.

isteves commented 6 years ago

@mbjones I'll submit another PR (later today/tomorrow) to add some tests!

isteves commented 6 years ago

Actually, just noticed that @gothub wrote a test already! 9947be00e9eb310d1d3d65e1dcc6b0e174aed4b2