Skip to content

Commit

Permalink
#21 support edit operation
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jul 31, 2019
1 parent dd28a5c commit 2b042d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions R/ZenodoManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
#' newly created in Zenodo, as an object of class \code{ZenodoRecord}
#' with an assigned identifier.
#' }
#' \item{\code{editRecord(recordId)}}{
#' Unlocks a record already submitted. This is required to edit metadata of a Zenodo
#' record already published.
#' }
#' \item{\code{publishRecord(recordId)}}{
#' Publishes a deposited record online.
#' }
Expand Down Expand Up @@ -698,6 +702,23 @@ ZenodoManager <- R6Class("ZenodoManager",
return(self$depositRecord(NULL))
},

#editRecord
editRecord = function(recordId){
zenReq <- ZenodoRequest$new(private$url, "POST", sprintf("deposit/depositions/%s/actions/edit", recordId),
token = private$token,
logger = self$loggerType)
zenReq$execute()
out <- NULL
if(zenReq$getStatus() == 201){
out <- ZenodoRecord$new(obj = zenReq$getResponse())
self$INFO(sprintf("Successful unlocked record '%s' for edition", recordId))
}else{
out <- zenReq$getResponse()
self$ERROR(sprintf("Error while unlocking record '%s' for edition: %s", recordId, out$message))
}
return(out)
},

#publisRecord
publishRecord = function(recordId){
zenReq <- ZenodoRequest$new(private$url, "POST", sprintf("deposit/depositions/%s/actions/publish",recordId),
Expand Down
4 changes: 4 additions & 0 deletions man/ZenodoManager.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2b042d8

Please sign in to comment.