-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added search functionality to get_publications() (#67)
* Added search functionality to get_publications() * Updated news.md with development updates * Added no rows returned warning function * Added test for warning_no_rows * Added clean up to remove spaces from search string in get_publications * Updates to get publications tests * Update tests/testthat/test-get_publication.R Co-authored-by: Cam Race <52536248+cjrace@users.noreply.github.com> * Adjusting publication search tests based on PR comments * Redoing a bit I accidentally undid on the publication search testing --------- Co-authored-by: Cam Race <52536248+cjrace@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
163 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#' Warn on zero rows returned | ||
#' | ||
#' @param api_result Output from an API get query | ||
#' | ||
#' @return Original input (api_result) unchanged | ||
#' | ||
#' @keywords internal | ||
#' | ||
#' @examples | ||
#' response_page <- httr::GET(api_url("get-publications", search = "bob")) |> | ||
#' httr::content("text") |> | ||
#' jsonlite::fromJSON() |> | ||
#' eesyapi:::warning_no_rows() | ||
warning_no_rows <- function(api_result) { | ||
if (api_result$paging$totalResults == 0) { | ||
warning( | ||
paste0( | ||
"Your query returned zero rows." | ||
) | ||
) | ||
} | ||
return(api_result) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
test_that("Get publications returns warning when no rows returned", { | ||
expect_warning( | ||
x <- get_publications(search = "z3x4c5v6b7"), | ||
"Your query returned zero rows." | ||
) | ||
}) |