forked from CIP-RIU/brapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathba_check.R
30 lines (27 loc) · 809 Bytes
/
ba_check.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#' ba_check
#'
#' Checks if a BrAPI server can be reached given the connection details.
#'
#' Raises errors.
#' @param con brapi_connection object
#' @param verbose logical; default TRUE
#' @param brapi_calls character vector; default: any. Use to check if one or more calls are implemented by the server according to the calls url.
#' @family brapiutils
#'
#' @return logical
#' @author Reinhard Simon
#' @example inst/examples/ex-ba_check.R
#' @export
ba_check <- function(con = NULL, verbose = TRUE, brapi_calls = "any") {
stopifnot(is.ba_con(con))
stopifnot(is.logical(verbose))
stopifnot(is.character(brapi_calls))
url <- con$db
ba_can_internet()
ba_can_internet(url)
if (verbose) {
ba_message("BrAPI connection ok.")
ba_message(paste(con, collapse = "\n"))
}
return(TRUE)
}