Skip to content

Commit

Permalink
#22 discard method
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Aug 2, 2019
1 parent 23bb092 commit 53bdd56
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions R/ZenodoManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
#' Unlocks a record already submitted. This is required to edit metadata of a Zenodo
#' record already published.
#' }
#' \item{\code{discardChanges(recordId)}}{
#' Discards changes operated on a record.
#' }
#' \item{\code{publishRecord(recordId)}}{
#' Publishes a deposited record online.
#' }
Expand Down Expand Up @@ -719,6 +722,23 @@ ZenodoManager <- R6Class("ZenodoManager",
return(out)
},

#discardChanges
discardChanges = function(recordId){
zenReq <- ZenodoRequest$new(private$url, "POST", sprintf("deposit/depositions/%s/actions/discard", 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 discarded changes for record '%s' for edition", recordId))
}else{
out <- zenReq$getResponse()
self$ERROR(sprintf("Error while discarding record '%s' changes: %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
3 changes: 3 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 53bdd56

Please sign in to comment.