diff --git a/DESCRIPTION b/DESCRIPTION index c82ddbf..aabfcb1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: rebird -Version: 1.3.9004 +Version: 1.3.9005 Title: R Client for the eBird Database of Bird Observations Description: A programmatic client for the eBird database (), including functions for searching for bird diff --git a/NEWS.md b/NEWS.md index ac4e29a..d9cf3b3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +rebird 1.3.9005 +=================== + +- Added `ebirdchecklist()`, which lets you view individual checklists (thanks @RichardLitt and @Rafnuss, #108). +- Made `ebirdregioncheck()`, `ebirdhotspot()`, `ebirdloc()` defunct. +- API tests now use `vcr`, which saves "cassettes" of the tests which can be played +in CI when running tests during CI, instead of storing an API key and having to run +tests remotely with every PR (thanks @slager). +- Updated `rebird`'s internal taxonomy after 2023 taxonomic update. + rebird 1.3.0 =================== diff --git a/R/ebirdfreq.R b/R/ebirdfreq.R index 6dbe4d7..80ce334 100644 --- a/R/ebirdfreq.R +++ b/R/ebirdfreq.R @@ -96,8 +96,8 @@ ebirdfreq <- function(loctype, loc, startyear = 1900, url <- "http://ebird.org/ebird/barchartData" url_full <- modify_url(url, query = args) message(url_full) - stop( - "This function has been made temporarily defunct as you now need to be + .Defunct( + msg = "This function has been made temporarily defunct as you now need to be logged into the eBird website to download frequency data, but we cannot authenticate via the API to do so. This function will be reinstated when the frequency data become available through the API. In the meantime, diff --git a/R/ebirdhotspot.R b/R/ebirdhotspot.R index ff3eaa4..c7c04a6 100644 --- a/R/ebirdhotspot.R +++ b/R/ebirdhotspot.R @@ -1,72 +1,8 @@ -#' Recent observations at hotspots -#' -#' Returns the most recent sighting information reported in a given vector -#' of hotspots. -#' -#' @param locID (required) Vector containing code(s) for up to 10 regions of -#' interest; here, regions are the locIDs of hotspots. Values that are not -#' valid or are not hotspots are ignored. -#' @param species Scientific name of the species of interest (not case -#' sensitive). Defaults to NULL, in which case sightings for all species -#' are returned. -#' See eBird taxonomy for more information: -#' http://ebird.org/content/ebird/about/ebird-taxonomy -#' @param back Number of days back to look for observations (between -#' 1 and 30, defaults to 14). -#' @param max Maximum number of result rows to return in this request -#' (between 1 and 10000, defaults to all) -#' @param locale Language/locale of response (when translations are available). -#' See http://java.sun.com/javase/6/docs/api/java/util/Locale.html -#' (defaults to en_US) -#' @param provisional Should flagged records that have not been reviewed -#' be included? (defaults to FALSE) -#' @param sleep Time (in seconds) before function sends API call (defaults to -#' zero. Set to higher number if you are using this function in a loop with -#' many API calls). -#' @param key eBird API key. You can obtain one from https://ebird.org/api/keygen. -#' We strongly recommend storing it in your \code{.Renviron} file as an -#' environment variable called \code{EBIRD_KEY}. -#' @param ... Curl options passed on to \code{\link[httr]{GET}} -#' @return A data.frame containing the collected information: -#' @return "comName": species common name -#' @return "howMany": number of individuals observed, NA if only presence was noted -#' @return "lat": latitude of the location -#' @return "lng": longitude of the location -#' @return "locID": unique identifier for the location -#' @return "locName": location name -#' @return "locationPrivate": TRUE if location is not a birding hotspot -#' @return "obsDt": observation date formatted according to ISO 8601 -#' (e.g. 'YYYY-MM-DD', or 'YYYY-MM-DD hh:mm'). Hours and minutes are excluded -#' if the observer did not report an observation time. -#' @return "obsReviewed": TRUE if observation has been reviewed, FALSE otherwise -#' @return "obsValid": TRUE if observation has been deemed valid by either the -#' automatic filters or a regional viewer, FALSE otherwise -#' @return "sciName" species' scientific name +#' This function is defunct. #' @export -#' @examples \dontrun{ -#' ebirdhotspot(locID=c('L99381','L99382'), species='larus delawarensis') -#' ebirdhotspot('L99381', max=10, provisional=TRUE) -#' } -#' @author Rafael Maia \email{rm72@@zips.uakron.edu} -#' @references \url{http://ebird.org/} +#' @rdname ebirdhotspot-defunct +#' @keywords internal -ebirdhotspot <- function(locID, species=NULL, back = NULL, max = NULL, locale = NULL, - provisional = FALSE, sleep = 0, key = NULL, ...) { - .Deprecated(new = "ebirdregion", - msg = "Deprecated: 'ebirdhotspot' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead.") - if(length(locID) > 10) { - stop('Too many locations (maximum 10)') - } - - Sys.sleep(sleep) - - if(!is.null(back)) back <- round(back) - - url <- paste0(ebase(), 'data/obs/', if(!is.null(species)) 'hotspot_spp/recent' else 'hotspot/recent') - args <- ebird_compact(list(fmt='json', sci=species, back=back, maxResults=max, locale=locale)) - locs <- as.list(locID) - names(locs) <- rep("r", length(locID)) - args <- c(args,locs) - if(provisional) args$includeProvisional <- 'true' - ebird_GET(url, args, key = key, ...) -} +ebirdhotspot <- function(...) { # nocov start + .Defunct(new = "ebirdregion") +} # nocov end diff --git a/R/ebirdloc.R b/R/ebirdloc.R index 65f15cc..06c3148 100644 --- a/R/ebirdloc.R +++ b/R/ebirdloc.R @@ -1,92 +1,8 @@ -#' Recent observations at a locality -#' -#' Returns the most recent sighting information reported in a given vector -#' of locations (including non-hotspots). -#' -#' @param locID (required) Vector containing code(s) for up to 10 regions of interest; -#' here, values that are not hotspots are returned. Values that are not valid are ignored. -#' @param species Scientific name of the species of interest (not case -#' sensitive). Defaults to NULL, in which case sightings for all species are returned. -#' See eBird taxonomy for more information: -#' http://ebird.org/content/ebird/about/ebird-taxonomy -#' @param back Number of days back to look for observations (between -#' 1 and 30, defaults to 14). -#' @param max Maximum number of result rows to return in this request -#' (between 1 and 10000, defaults to all) -#' @param locale Language/locale of response (when translations are available). -#' See http://java.sun.com/javase/6/docs/api/java/util/Locale.html -#' (defaults to en_US) -#' @param provisional Should flagged records that have not been reviewed -#' be included? (defaults to FALSE) -#' @param simple Logical. Whether to return a simple (TRUE, default) or detailed -#' (FALSE) set of results fields. -#' @param sleep Time (in seconds) before function sends API call (defaults to -#' zero. Set to higher number if you are using this function in a loop with -#' many API calls). -#' @param key ebird API key. You can obtain one from https://ebird.org/api/keygen. -#' We strongly recommend storing it in your \code{.Renviron} file as an -#' environment variable called \code{EBIRD_KEY}. -#' @param ... Curl options passed on to \code{\link[httr]{GET}} -#' @return A data.frame containing the collected information: -#' @return "comName": species common name -#' @return "howMany": number of individuals observed, NA if only presence was noted -#' @return "lat": latitude of the location -#' @return "lng": longitude of the location -#' @return "locID": unique identifier for the location -#' @return "locName": location name -#' @return "locationPrivate": TRUE if location is not a birding hotspot -#' @return "obsDt": observation date formatted according to ISO 8601 -#' (e.g. 'YYYY-MM-DD', or 'YYYY-MM-DD hh:mm'). Hours and minutes are excluded -#' if the observer did not report an observation time. -#' @return "obsReviewed": TRUE if observation has been reviewed, FALSE otherwise -#' @return "obsValid": TRUE if observation has been deemed valid by either the -#' automatic filters or a regional viewer, FALSE otherwise -#' @return "sciName" species' scientific name -#' @return "subnational2Code": county code (returned if simple=FALSE) -#' @return "subnational2Name": county name (returned if simple=FALSE) -#' @return "subnational1Code": state/province ISO code (returned if simple=FALSE) -#' @return "subnational1Name": state/province name (returned if simple=FALSE) -#' @return "countryCode": country ISO code (returned if simple=FALSE) -#' @return "countryName": country name (returned if simple=FALSE) -#' @return "userDisplayName": first and last name of the observer (returned if simple=FALSE) -#' @return "firstName": observer's first name (returned if simple=FALSE) -#' @return "lastName": observer's last name (returned if simple=FALSE) -#' @return "subID": submission ID (returned if simple=FALSE) -#' @return "obsID": observation ID (returned if simple=FALSE) -#' @return "checklistID": checklist ID (returned if simple=FALSE) -#' @return "presenceNoted": 'true' if user marked presence but did not count the -#' number of birds. 'false' otherwise (returned if simple=FALSE) +#' This function is defunct. #' @export -#' @examples \dontrun{ -#' ebirdloc(locID = c('L99381','L99382')) -#' ebirdloc('L99381', 'Branta canadensis', provisional=TRUE) -#' } -#' @author Rafael Maia \email{rm72@@zips.uakron.edu} -#' @references \url{http://ebird.org/} +#' @rdname ebirdloc-defunct +#' @keywords internal -ebirdloc <- function(locID, species=NULL, back = NULL, max = NULL, locale = NULL, - provisional = FALSE, simple = TRUE, sleep = 0, key = NULL, ...) { # nocov start - .Deprecated(new = "ebirdregion", - msg = "Deprecated: 'ebirdloc' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead.") - if (length(locID) > 10) { - stop('Too many locations (max. 10)', call. = FALSE) - } - - Sys.sleep(sleep) - url <- paste0(ebase(), 'data/obs/', if(!is.null(species)) 'loc_spp/recent' else 'loc/recent') - - if(!is.null(back)) { - back <- round(back) - } - - locID <- if(!is.null(locID)) locID <- paste0(locID, collapse = ",") - args <- ebird_compact(list( - fmt='json', sci=species, - r=locID, back=back, maxResults=max, - locale=locale - )) - if (provisional) args$includeProvisional <- 'true' - if (!simple) args$detail <- 'full' - - ebird_GET(url, args, key = key, ...) +ebirdloc <- function(...) { # nocov start + .Defunct(new = "ebirdregion") } # nocov end diff --git a/R/ebirdregioncheck.R b/R/ebirdregioncheck.R index 62aff7c..e21f067 100644 --- a/R/ebirdregioncheck.R +++ b/R/ebirdregioncheck.R @@ -1,33 +1,8 @@ -#' Check if a region type is valid -#' -#' @param loc The location code to be checked. -#' @param key ebird API key. You can obtain one from https://ebird.org/api/keygen. -#' We strongly recommend storing it in your \code{.Renviron} file as an -#' environment variable called \code{EBIRD_KEY}. -#' @param ... Curl options passed on to \code{\link[httr]{GET}} -#' -#' @return Logical. +#' This function is defunct. #' @export -#' -#' @examples \dontrun{ -#' ebirdregioncheck("US") -#' ebirdregioncheck("CA-BC") -#' ebirdregioncheck("CA-BC-GV") -#' } -#' @author Sebastian Pardo \email{sebpardo@@gmail.com}, -#' Andy Teucher \email{andy.teucher@@gmail.com} -#' @references \url{http://ebird.org/} +#' @rdname ebirdregioncheck-defunct +#' @keywords internal -ebirdregioncheck <- function(loc, key = NULL, ...) { # nocov start - .Deprecated(new = "ebirdregioninfo", - msg = "Deprecated: 'ebirdregioncheck' will be removed in the next version of rebird. Use 'ebirdregioninfo' instead.") - if (length(loc) > 1) { - stop("More than one location specified") - } - out <- try(ebirdregioninfo(loc, key = key, ...), silent = TRUE) - if ("try-error" %in% class(out) && - !grepl("No region with code", out) && # To avoid error when using "HTTP 404" as location - grepl("HTTP [403|400]", out)) stop(out) # HTTP error codes that should - # throw errors rather than return false - "tbl_df" %in% class(out) +ebirdregioncheck <- function(...) { # nocov start + .Defunct(new = "ebirdregioninfo") } # nocov end diff --git a/R/rebird-defunct.R b/R/rebird-defunct.R new file mode 100644 index 0000000..a193970 --- /dev/null +++ b/R/rebird-defunct.R @@ -0,0 +1,10 @@ +#' Defunct functions in rebird +#' +#' \itemize{ +#' \item \code{\link{ebirdregioncheck}}: Use 'ebirdregioninfo' instead. +#' \item \code{\link{ebirdloc}}: Use 'ebirdregion' instead. +#' \item \code{\link{ebirdhotspot}}: Use 'ebirdregion' instead. +#' } +#' +#' @name rebird-defunct +NULL \ No newline at end of file diff --git a/R/rebird-deprecated.R b/R/rebird-deprecated.R deleted file mode 100644 index e1ce349..0000000 --- a/R/rebird-deprecated.R +++ /dev/null @@ -1,12 +0,0 @@ -#' Deprecated functions in rebird -#' -#' These functions still work but will be removed (defunct) in the next version. -#' -#' \itemize{ -#' \item \code{\link{ebirdregioncheck}}: Deprecated: 'ebirdregioncheck' will be removed in the next version of rebird. Use 'ebirdregioninfo' instead. -#' \item \code{\link{ebirdloc}}: Deprecated: 'ebirdloc' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead. -#' \item \code{\link{ebirdhotspot}}: Deprecated: 'ebirdhotspot' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead. -#' } -#' -#' @name rebird-deprecated -NULL \ No newline at end of file diff --git a/man/ebirdhotspot-defunct.Rd b/man/ebirdhotspot-defunct.Rd new file mode 100644 index 0000000..baf7c21 --- /dev/null +++ b/man/ebirdhotspot-defunct.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ebirdhotspot.R +\name{ebirdhotspot} +\alias{ebirdhotspot} +\title{This function is defunct.} +\usage{ +ebirdhotspot(...) +} +\description{ +This function is defunct. +} +\keyword{internal} diff --git a/man/ebirdhotspot.Rd b/man/ebirdhotspot.Rd deleted file mode 100644 index bc12e45..0000000 --- a/man/ebirdhotspot.Rd +++ /dev/null @@ -1,96 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ebirdhotspot.R -\name{ebirdhotspot} -\alias{ebirdhotspot} -\title{Recent observations at hotspots} -\usage{ -ebirdhotspot( - locID, - species = NULL, - back = NULL, - max = NULL, - locale = NULL, - provisional = FALSE, - sleep = 0, - key = NULL, - ... -) -} -\arguments{ -\item{locID}{(required) Vector containing code(s) for up to 10 regions of -interest; here, regions are the locIDs of hotspots. Values that are not -valid or are not hotspots are ignored.} - -\item{species}{Scientific name of the species of interest (not case -sensitive). Defaults to NULL, in which case sightings for all species -are returned. -See eBird taxonomy for more information: -http://ebird.org/content/ebird/about/ebird-taxonomy} - -\item{back}{Number of days back to look for observations (between -1 and 30, defaults to 14).} - -\item{max}{Maximum number of result rows to return in this request -(between 1 and 10000, defaults to all)} - -\item{locale}{Language/locale of response (when translations are available). -See http://java.sun.com/javase/6/docs/api/java/util/Locale.html -(defaults to en_US)} - -\item{provisional}{Should flagged records that have not been reviewed -be included? (defaults to FALSE)} - -\item{sleep}{Time (in seconds) before function sends API call (defaults to -zero. Set to higher number if you are using this function in a loop with -many API calls).} - -\item{key}{eBird API key. You can obtain one from https://ebird.org/api/keygen. -We strongly recommend storing it in your \code{.Renviron} file as an -environment variable called \code{EBIRD_KEY}.} - -\item{...}{Curl options passed on to \code{\link[httr]{GET}}} -} -\value{ -A data.frame containing the collected information: - -"comName": species common name - -"howMany": number of individuals observed, NA if only presence was noted - -"lat": latitude of the location - -"lng": longitude of the location - -"locID": unique identifier for the location - -"locName": location name - -"locationPrivate": TRUE if location is not a birding hotspot - -"obsDt": observation date formatted according to ISO 8601 - (e.g. 'YYYY-MM-DD', or 'YYYY-MM-DD hh:mm'). Hours and minutes are excluded - if the observer did not report an observation time. - -"obsReviewed": TRUE if observation has been reviewed, FALSE otherwise - -"obsValid": TRUE if observation has been deemed valid by either the - automatic filters or a regional viewer, FALSE otherwise - -"sciName" species' scientific name -} -\description{ -Returns the most recent sighting information reported in a given vector -of hotspots. -} -\examples{ -\dontrun{ -ebirdhotspot(locID=c('L99381','L99382'), species='larus delawarensis') -ebirdhotspot('L99381', max=10, provisional=TRUE) -} -} -\references{ -\url{http://ebird.org/} -} -\author{ -Rafael Maia \email{rm72@zips.uakron.edu} -} diff --git a/man/ebirdloc-defunct.Rd b/man/ebirdloc-defunct.Rd new file mode 100644 index 0000000..b062161 --- /dev/null +++ b/man/ebirdloc-defunct.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ebirdloc.R +\name{ebirdloc} +\alias{ebirdloc} +\title{This function is defunct.} +\usage{ +ebirdloc(...) +} +\description{ +This function is defunct. +} +\keyword{internal} diff --git a/man/ebirdloc.Rd b/man/ebirdloc.Rd deleted file mode 100644 index 3e124ea..0000000 --- a/man/ebirdloc.Rd +++ /dev/null @@ -1,125 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ebirdloc.R -\name{ebirdloc} -\alias{ebirdloc} -\title{Recent observations at a locality} -\usage{ -ebirdloc( - locID, - species = NULL, - back = NULL, - max = NULL, - locale = NULL, - provisional = FALSE, - simple = TRUE, - sleep = 0, - key = NULL, - ... -) -} -\arguments{ -\item{locID}{(required) Vector containing code(s) for up to 10 regions of interest; -here, values that are not hotspots are returned. Values that are not valid are ignored.} - -\item{species}{Scientific name of the species of interest (not case -sensitive). Defaults to NULL, in which case sightings for all species are returned. -See eBird taxonomy for more information: -http://ebird.org/content/ebird/about/ebird-taxonomy} - -\item{back}{Number of days back to look for observations (between -1 and 30, defaults to 14).} - -\item{max}{Maximum number of result rows to return in this request -(between 1 and 10000, defaults to all)} - -\item{locale}{Language/locale of response (when translations are available). -See http://java.sun.com/javase/6/docs/api/java/util/Locale.html -(defaults to en_US)} - -\item{provisional}{Should flagged records that have not been reviewed -be included? (defaults to FALSE)} - -\item{simple}{Logical. Whether to return a simple (TRUE, default) or detailed -(FALSE) set of results fields.} - -\item{sleep}{Time (in seconds) before function sends API call (defaults to -zero. Set to higher number if you are using this function in a loop with -many API calls).} - -\item{key}{ebird API key. You can obtain one from https://ebird.org/api/keygen. -We strongly recommend storing it in your \code{.Renviron} file as an -environment variable called \code{EBIRD_KEY}.} - -\item{...}{Curl options passed on to \code{\link[httr]{GET}}} -} -\value{ -A data.frame containing the collected information: - -"comName": species common name - -"howMany": number of individuals observed, NA if only presence was noted - -"lat": latitude of the location - -"lng": longitude of the location - -"locID": unique identifier for the location - -"locName": location name - -"locationPrivate": TRUE if location is not a birding hotspot - -"obsDt": observation date formatted according to ISO 8601 - (e.g. 'YYYY-MM-DD', or 'YYYY-MM-DD hh:mm'). Hours and minutes are excluded - if the observer did not report an observation time. - -"obsReviewed": TRUE if observation has been reviewed, FALSE otherwise - -"obsValid": TRUE if observation has been deemed valid by either the - automatic filters or a regional viewer, FALSE otherwise - -"sciName" species' scientific name - -"subnational2Code": county code (returned if simple=FALSE) - -"subnational2Name": county name (returned if simple=FALSE) - -"subnational1Code": state/province ISO code (returned if simple=FALSE) - -"subnational1Name": state/province name (returned if simple=FALSE) - -"countryCode": country ISO code (returned if simple=FALSE) - -"countryName": country name (returned if simple=FALSE) - -"userDisplayName": first and last name of the observer (returned if simple=FALSE) - -"firstName": observer's first name (returned if simple=FALSE) - -"lastName": observer's last name (returned if simple=FALSE) - -"subID": submission ID (returned if simple=FALSE) - -"obsID": observation ID (returned if simple=FALSE) - -"checklistID": checklist ID (returned if simple=FALSE) - -"presenceNoted": 'true' if user marked presence but did not count the - number of birds. 'false' otherwise (returned if simple=FALSE) -} -\description{ -Returns the most recent sighting information reported in a given vector -of locations (including non-hotspots). -} -\examples{ -\dontrun{ -ebirdloc(locID = c('L99381','L99382')) -ebirdloc('L99381', 'Branta canadensis', provisional=TRUE) -} -} -\references{ -\url{http://ebird.org/} -} -\author{ -Rafael Maia \email{rm72@zips.uakron.edu} -} diff --git a/man/ebirdregioncheck-defunct.Rd b/man/ebirdregioncheck-defunct.Rd new file mode 100644 index 0000000..36189b9 --- /dev/null +++ b/man/ebirdregioncheck-defunct.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/ebirdregioncheck.R +\name{ebirdregioncheck} +\alias{ebirdregioncheck} +\title{This function is defunct.} +\usage{ +ebirdregioncheck(...) +} +\description{ +This function is defunct. +} +\keyword{internal} diff --git a/man/ebirdregioncheck.Rd b/man/ebirdregioncheck.Rd deleted file mode 100644 index 2ac7973..0000000 --- a/man/ebirdregioncheck.Rd +++ /dev/null @@ -1,37 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ebirdregioncheck.R -\name{ebirdregioncheck} -\alias{ebirdregioncheck} -\title{Check if a region type is valid} -\usage{ -ebirdregioncheck(loc, key = NULL, ...) -} -\arguments{ -\item{loc}{The location code to be checked.} - -\item{key}{ebird API key. You can obtain one from https://ebird.org/api/keygen. -We strongly recommend storing it in your \code{.Renviron} file as an -environment variable called \code{EBIRD_KEY}.} - -\item{...}{Curl options passed on to \code{\link[httr]{GET}}} -} -\value{ -Logical. -} -\description{ -Check if a region type is valid -} -\examples{ -\dontrun{ -ebirdregioncheck("US") -ebirdregioncheck("CA-BC") -ebirdregioncheck("CA-BC-GV") -} -} -\references{ -\url{http://ebird.org/} -} -\author{ -Sebastian Pardo \email{sebpardo@gmail.com}, - Andy Teucher \email{andy.teucher@gmail.com} -} diff --git a/man/rebird-defunct.Rd b/man/rebird-defunct.Rd new file mode 100644 index 0000000..aca8079 --- /dev/null +++ b/man/rebird-defunct.Rd @@ -0,0 +1,12 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rebird-defunct.R +\name{rebird-defunct} +\alias{rebird-defunct} +\title{Defunct functions in rebird} +\description{ +\itemize{ + \item \code{\link{ebirdregioncheck}}: Use 'ebirdregioninfo' instead. + \item \code{\link{ebirdloc}}: Use 'ebirdregion' instead. + \item \code{\link{ebirdhotspot}}: Use 'ebirdregion' instead. +} +} diff --git a/man/rebird-deprecated.Rd b/man/rebird-deprecated.Rd deleted file mode 100644 index 1279e88..0000000 --- a/man/rebird-deprecated.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rebird-deprecated.R -\name{rebird-deprecated} -\alias{rebird-deprecated} -\title{Deprecated functions in rebird} -\description{ -These functions still work but will be removed (defunct) in the next version. -} -\details{ -\itemize{ - \item \code{\link{ebirdregioncheck}}: Deprecated: 'ebirdregioncheck' will be removed in the next version of rebird. Use 'ebirdregioninfo' instead. - \item \code{\link{ebirdloc}}: Deprecated: 'ebirdloc' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead. - \item \code{\link{ebirdhotspot}}: Deprecated: 'ebirdhotspot' will be removed in the next version of rebird as it might not be supported in the new eBird API. Use 'ebirdregion' instead. -} -} diff --git a/tests/fixtures/ebirdhotspot.yml b/tests/fixtures/ebirdhotspot.yml deleted file mode 100644 index bc3789c..0000000 --- a/tests/fixtures/ebirdhotspot.yml +++ /dev/null @@ -1,82 +0,0 @@ -http_interactions: -- request: - method: get - uri: https://ebird.org/ws2.0/data/obs/hotspot/recent?fmt=json&maxResults=3&r=L99381&includeProvisional=true - body: - encoding: '' - string: '' - headers: - Accept: application/json, text/xml, application/xml, */* - X-eBirdApiToken: <<>> - response: - status: - status_code: 200 - category: Success - reason: OK - message: 'Success: (200) OK' - headers: - cache-control: no-cache, no-store, max-age=0, must-revalidate - content-encoding: gzip - content-length: '299' - content-type: application/json;charset=utf-8 - date: Wed, 06 Mar 2024 06:30:44 GMT - expires: '0' - pragma: no-cache - server: Apache - strict-transport-security: max-age=31536000 ; includeSubDomains - vary: - - Accept-Encoding - - Accept-Encoding,Origin,Access-Control-Request-Method,Access-Control-Request-Headers - x-content-type-options: nosniff - x-frame-options: DENY - x-xss-protection: 1; mode=block - body: - encoding: '' - file: no - string: '[{"speciesCode":"cangoo","comName":"Canada Goose","sciName":"Branta - canadensis","locId":"L99381","locName":"Stewart Park","obsDt":"2024-03-05 - 16:38","howMany":2,"lat":42.460791,"lng":-76.5068525,"obsValid":true,"obsReviewed":false,"locationPrivate":false,"subId":"S163830741"},{"speciesCode":"mallar3","comName":"Mallard","sciName":"Anas - platyrhynchos","locId":"L99381","locName":"Stewart Park","obsDt":"2024-03-05 - 16:38","howMany":2,"lat":42.460791,"lng":-76.5068525,"obsValid":true,"obsReviewed":false,"locationPrivate":false,"subId":"S163830741"},{"speciesCode":"commer","comName":"Common - Merganser","sciName":"Mergus merganser","locId":"L99381","locName":"Stewart - Park","obsDt":"2024-03-05 16:38","howMany":2,"lat":42.460791,"lng":-76.5068525,"obsValid":true,"obsReviewed":false,"locationPrivate":false,"subId":"S163830741"}]' - recorded_at: 2024-03-06 06:34:11 GMT - recorded_with: vcr/1.2.2, webmockr/0.9.0 -- request: - method: get - uri: https://ebird.org/ws2.0/data/obs/hotspot/recent?fmt=json&back=40&r=L99381 - body: - encoding: '' - string: '' - headers: - Accept: application/json, text/xml, application/xml, */* - X-eBirdApiToken: <<>> - response: - status: - status_code: 400 - category: Client error - reason: Bad Request - message: 'Client error: (400) Bad Request' - headers: - cache-control: no-cache, no-store, max-age=0, must-revalidate - content-encoding: gzip - content-length: '146' - content-type: application/json - date: Wed, 06 Mar 2024 06:30:45 GMT - expires: '0' - pragma: no-cache - server: Apache - strict-transport-security: max-age=31536000 ; includeSubDomains - vary: - - Accept-Encoding - - Accept-Encoding,Origin,Access-Control-Request-Method,Access-Control-Request-Headers - x-content-type-options: nosniff - x-frame-options: DENY - x-xss-protection: 1; mode=block - body: - encoding: '' - file: no - string: '{"errors":[{"status":"400 BAD_REQUEST","code":"error.data.too_many_back","title":"Field - back of rawDataCmd: The maximum number of days back is 30"}]}' - recorded_at: 2024-03-06 06:34:11 GMT - recorded_with: vcr/1.2.2, webmockr/0.9.0 diff --git a/tests/testthat/test-ebirdfreq.R b/tests/testthat/test-ebirdfreq.R index f4a545b..b26166b 100644 --- a/tests/testthat/test-ebirdfreq.R +++ b/tests/testthat/test-ebirdfreq.R @@ -1,5 +1,5 @@ test_that("ebirdfreq works correctly", { - expect_error(ebirdfreq("counties", "CA-BC-GV"), "This function has been made temporarily defunct") + expect_error(suppressMessages(ebirdfreq("counties", "CA-BC-GV")), "This function has been made temporarily defunct") # # Temporary commenting of tests while function is made defunct # long <- ebirdfreq("counties", "CA-BC-GV") diff --git a/tests/testthat/test-ebirdhotspot.R b/tests/testthat/test-ebirdhotspot.R index f66664b..b343242 100644 --- a/tests/testthat/test-ebirdhotspot.R +++ b/tests/testthat/test-ebirdhotspot.R @@ -1,10 +1,6 @@ -vcr::use_cassette("ebirdhotspot", { - test_that("ebirdhotspot works correctly", { +context("ebirdhotspot") - expect_warning(out <- ebirdhotspot('L99381', max = 3, provisional = TRUE)) - expect_is(out, "data.frame") - expect_is(out$comName, "character") - expect_warning(expect_error(ebirdhotspot(locID = letters))) - expect_warning(expect_error(ebirdhotspot(locID = 'L99381', back = 40))) - }) +test_that("ebirdhotspot fails correctly", { + + expect_error(ebirdhotspot(), "defunct") }) diff --git a/tests/testthat/test-ebirdloc.R b/tests/testthat/test-ebirdloc.R index 48a09a8..ceb3eea 100644 --- a/tests/testthat/test-ebirdloc.R +++ b/tests/testthat/test-ebirdloc.R @@ -1,37 +1,6 @@ context("ebirdloc") -test_that("ebirdloc works correctly", { - skip_on_cran() - skip_on_ci() - - expect_warning(out <- ebirdloc(c('L99381','L99382'))) - expect_is(out, "data.frame") - expect_is(out$comName, "character") - expect_warning(out2 <- ebirdloc('L99381', 'larus delawarensis', provisional=TRUE)) - expect_is(out2, "data.frame") - - expect_warning(simpler <- ebirdloc('L99381', max = 1, simple = TRUE)) - expect_warning(lesssimpler <- ebirdloc('L99381', max = 1, simple = FALSE)) - expect_lt(NCOL(simpler), 15) - expect_gt(NCOL(simpler), 8) - expect_lt(NCOL(lesssimpler), 40) - expect_gt(NCOL(lesssimpler), 10) -}) - - test_that("ebirdloc fails correctly", { - skip_on_cran() - skip_on_ci() - - mssg <- "You have supplied an invalid species category" - - expect_error(suppressWarnings(ebirdloc())) - expect_error(suppressWarnings(ebirdloc(species = "asdf"))) - expect_error(suppressWarnings(ebirdloc(locID = "L99381", species = "asdf"))) - expect_error(suppressWarnings(ebirdloc()), "argument \"locID\" is missing") - expect_error(suppressWarnings(ebirdloc(locID = c('L99381','L99382','L99381','L99382','L99381','L99382', - 'L99381','L99382','L99381','L99382','L99382'))), - "Too many locations") - expect_error(suppressWarnings(ebirdloc(locID = 'L99381', config=timeout(0.001)))) - expect_error(suppressWarnings(ebirdloc(locID = 'L99381', sleep = "adf")), "invalid 'time' value") + + expect_error(ebirdregioncheck(), "defunct") }) diff --git a/tests/testthat/test-ebirdregioncheck.R b/tests/testthat/test-ebirdregioncheck.R index 6a9b000..2ce8cb2 100644 --- a/tests/testthat/test-ebirdregioncheck.R +++ b/tests/testthat/test-ebirdregioncheck.R @@ -1,30 +1,7 @@ context("ebirdregioncheck") -test_that("ebirdregioncheck works correctly", { - skip_on_cran() - skip_on_ci() - - expect_warning(expect_is(ebirdregioncheck("CA"), "logical")) - expect_warning(expect_equal(ebirdregioncheck("CA"), TRUE)) - expect_warning(expect_equal(ebirdregioncheck("CA-BC"), TRUE)) - expect_warning(expect_equal(ebirdregioncheck("CA-BC-CP"), TRUE)) - expect_warning(expect_equal(ebirdregioncheck("ZZ"), FALSE)) - expect_warning(expect_equal(ebirdregioncheck(1L), TRUE)) - expect_warning(expect_equal(ebirdregioncheck("CA-ZZ"), FALSE)) - expect_warning(expect_equal(ebirdregioncheck("counties"), FALSE)) - expect_warning(expect_equal(ebirdregioncheck("HTTP 400"), FALSE)) - expect_warning(expect_equal(ebirdregioncheck("No region with code HTTP 400"), FALSE)) -}) - test_that("ebirdregioncheck fails correctly", { - skip_on_cran() - skip_on_ci() - expect_error(suppressWarnings(ebirdregioncheck())) - expect_error(suppressWarnings(ebirdregioncheck(c("foo", "bar")))) - expect_error(suppressWarnings(ebirdregioncheck(c("foo", "bar")))) - expect_error(suppressWarnings(ebirdregioncheck("foo", "CA-BC-ZZ"))) - expect_error(suppressWarnings(ebirdregioncheck("CA", key = "foo"))) - expect_error(suppressWarnings(ebirdregioncheck(c("country", "CA")))) + expect_error(ebirdregioncheck(), "defunct") }) \ No newline at end of file