Skip to content

Commit

Permalink
api matching using agrepl instead of grepl
Browse files Browse the repository at this point in the history
  • Loading branch information
JsLth committed Jun 24, 2024
1 parent b548ae3 commit 99eef9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ o311_cache <- new.env(parent = emptyenv())
#' an implementation of the open311 standard. It consists of an endpoint name
#' (e.g. a city), a root URL, and a jurisdiction ID. To unambiguously identify
#' an API, you can provide an endpoint, a jurisdiction ID, or both. The input
#' is matched with \code{\link{o311_endpoints}} to select an API. The
#' is fuzzy-matched with \code{\link{o311_endpoints}} to select an API. The
#' selected API is available to other \code{o311_*} functions until the
#' session is terminated or until it is overwritten.
#'
Expand Down Expand Up @@ -56,8 +56,11 @@ o311_cache <- new.env(parent = emptyenv())
#'
#' # calls without arguments return the current API
#' o311_api()
#' @seealso \code{\link{o311_requests}}, \code{\link{o311_request}},
#' @seealso
#' \code{\link{o311_requests}}, \code{\link{o311_request}},
#' \code{\link{o311_services}}
#'
#' \code{\link{agrepl}}
#' @export
o311_api <- function(endpoint = NULL,
jurisdiction = NULL,
Expand All @@ -74,7 +77,7 @@ o311_api <- function(endpoint = NULL,
if (!is.null(jurisdiction)) {
endpoints <- endpoints[endpoints$jurisdiction %in% jurisdiction, ]
} else if (!is.null(endpoint)) {
endpoints <- endpoints[grepl(
endpoints <- endpoints[agrepl(
endpoint,
endpoints$name,
ignore.case = TRUE
Expand Down
4 changes: 3 additions & 1 deletion man/o311_api.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99eef9a

Please sign in to comment.