Skip to content

Commit

Permalink
update INSPIRE endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jan 2, 2025
1 parent ebeacef commit 08df4a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/INSPIREMetadataValidator.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ INSPIREMetadataValidator <- R6Class("INSPIREMetadataValidator",
url = "https://inspire.ec.europa.eu/validator/v2",
#'@field running wether the service is up and running
running = FALSE,
status = NULL,

#'@description Method used to instantiate an INSPIRE Metadata validator. To check
#' metadata with the INSPIRE metadata validator, a user API key is now required,
Expand All @@ -43,7 +44,7 @@ INSPIREMetadataValidator <- R6Class("INSPIREMetadataValidator",
#'@param url url
#'@param apiKey API key
#'@param keyring_backend backend name to use with \pkg{keyring} to store API key
initialize = function(url = "https://inspire.ec.europa.eu/validator/v2",
initialize = function(url = "https://inspire.ec.europa.eu/validator-api",
apiKey, keyring_backend = 'env'){
if(!require("httr")){
stop("The INSPIRE metadata validator requires the installation of 'httr' package")
Expand All @@ -53,8 +54,10 @@ INSPIREMetadataValidator <- R6Class("INSPIREMetadataValidator",
private$keyring_service <- paste0("geometa@", self$url)
if(!is.null(apiKey)) private$keyring_backend$set_with_value(private$keyring_service, username = "geometa_inspire_validator", password = apiKey)

ping <- status_code(HEAD(paste(self$url, "status", sep = "/")))
ping_req = GET(paste(self$url, "status", sep = "/"))
ping <- status_code(ping_req)
self$running <- if(ping==200) TRUE else FALSE
self$status <- content(ping_req)$status

},

Expand Down

0 comments on commit 08df4a7

Please sign in to comment.