Skip to content

Commit

Permalink
#133 getDepositionById
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed May 14, 2024
1 parent 129e396 commit f4b9ad3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions R/ZenodoRecord.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ ZenodoRecord <- R6Class("ZenodoRecord",
self$metadata = obj$metadata
resource_type = self$metadata$resource_type
if(!is.null(resource_type)){
resource_type_id = resource_type$type
if(!is.null(resource_type$subtype)) resource_type_id = paste(resource_type_id, resource_type$subtype,sep="-")
resource_type_id = resource_type$id
self$metadata$resource_type = list(id = resource_type_id)
}
self$modified = obj$modified
Expand Down
7 changes: 5 additions & 2 deletions R/ZenodoRequest.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ ZenodoRequest <- R6Class("ZenodoRequest",
headers <- c(
"User-Agent" = private$agent,
"Authorization" = paste("Bearer",private$token),
"Accept" = "application/vnd.inveniordm.v1+json"
"Content-Type" = "application/json",
"Accept" = if(regexpr("draft/files", req)>0) "application/json" else "application/vnd.inveniordm.v1+json"
)

responseContent <- NULL
Expand Down Expand Up @@ -96,9 +97,11 @@ ZenodoRequest <- R6Class("ZenodoRequest",
req <- paste(url, request, sep="/")
if(!is.null(file)){
contentType <- "multipart/form-data"
accept <- "application/json"
data <- list(file = file, filename = data)
}else{
contentType <- "application/json"
accept = "application/vnd.inveniordm.v1+json"
data <- private$prepareData(data)
}

Expand All @@ -107,7 +110,7 @@ ZenodoRequest <- R6Class("ZenodoRequest",
"User-Agent" = private$agent,
"Authorization" = paste("Bearer",private$token),
"Content-Type" = contentType,
"Accept" = "application/vnd.inveniordm.v1+json"
"Accept" = accept
)

#send request
Expand Down

0 comments on commit f4b9ad3

Please sign in to comment.