eblondel / zen4R

zen4R - R Interface to Zenodo REST API
https://github.com/eblondel/zen4R/wiki
Other
44 stars 14 forks source link

fix getDepositionByConceptDOI method #59

Closed mpadge closed 2 years ago

mpadge commented 2 years ago

@eblondel The current code has the following lines:

https://github.com/eblondel/zen4R/blob/969053ac9d12b21cc32898dbe3ee0fbfe0bdc475/R/ZenodoManager.R#L593-L597

which presumes that the requested conceptdoi is the first element of the returned result, yet this is not necessarily so. In particular, personal releases associated with a token are delivered in chronological order. This PR rectifies by matching conceptdoi values of all returned results to find the desired one.

eblondel commented 2 years ago

Thanks @mpadge PS: tests might fail as they rely on sandbox and given the nb of requests, my sandbox account gets blocked at some point which makes fail tests. I still have to find a workaround or reduce nb of tests.

maelle commented 2 years ago

@eblondel might I suggest https://books.ropensci.org/http-testing/ :grin:

eblondel commented 2 years ago

for the timebeing it's fine, it depends on the nb of requests per hour/day, as you can see tests passed. I know that mocks should be an alternate, it was also suggested by Zenodo team while interacting with them on the matter... but I didn't have time to work on it, as i'm busy on other deliverables in production.

eblondel commented 2 years ago

hum, no it failed as well. I will try to find some time for mocking, meanwhile i'm also interacting with Zenodo to find a solution, as i'd like to have real integration tests as well based on the sandbox.

mpadge commented 2 years ago

Great, thanks @eblondel. This definitely should not affect code, as "old" behaviour will either correctly be restored for any and all calls which associate a token with a single release; otherwise it will fix any for this this might have previously failed. No idea how you could even test any of that, and I don't envy your position of having to figure that out. I merely remain grateful for the package!

eblondel commented 2 years ago

@mpadge you're welcome! FYI, I will push soon a revision to CRAN (in case you have few additional ajustements for zen4R to submit). I still have to perform further testing through integrated tool geoflow for Zenodo records versioning support, afterwhat it will go on CRAN. Best