Skip to content

Commit

Permalink
fixing documentation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
John Waller committed Sep 25, 2024
1 parent 2767e6b commit 2563a57
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ S3method(print,occ_download_describe)
S3method(print,occ_download_get)
S3method(print,occ_download_meta)
S3method(print,occ_download_prep)
S3method(print,occ_download_sql)
S3method(print,occ_download_sql_prep)
S3method(print,occ_predicate)
S3method(print,occ_predicate_list)
export("%>%")
Expand Down
30 changes: 18 additions & 12 deletions R/occ_download_sql.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@
#' @param user your GBIF user name
#' @param pwd your GBIF password
#' @param email your email address
#' @param validate should the query be validated before submission. Default is
#' TRUE.
#' @param curlopts list of curl options
#'
#' @details
#' This is an experimental feature, and the implementation may change throughout
#' 2024. The feature is currently only available for preview by invited users.
#' Contact [email protected] to request access.
#' Contact `[email protected]` to request access.
#'
#' Please see the article here for more information:
#' \url{https://docs.ropensci.org/rgbif/articles/getting_occurrence_data.html}
#'
#' @return an object of class 'occ_download_sql'
#'
#' @references
#' https://techdocs.gbif.org/en/data-use/api-sql-downloads
#' \url{https://techdocs.gbif.org/en/data-use/api-sql-downloads}
#'
#' @name occ_download_sql
#' @export
#'
#' @examples /dontrun{
#' @examples \dontrun{
#' occ_download_sql("SELECT gbifid,countryCode FROM occurrence
#' WHERE genusKey = 2435098")
#' }
Expand All @@ -29,14 +34,16 @@ occ_download_sql <- function(q = NULL,
format = "SQL_TSV_ZIP",
user = NULL,
pwd = NULL,
email = NULL,
email = NULL,
validate = TRUE,
curlopts = list()) {

z <- occ_download_sql_prep(q=q,
format=format,
user=user,
pwd=pwd,
email=email,
validate=validate,
curlopts=curlopts)

out <- rg_POST(z$url, req = z$request, user = z$user, pwd = z$pwd, curlopts=curlopts)
Expand All @@ -59,12 +66,14 @@ occ_download_sql <- function(q = NULL,

#' @name occ_download_sql
#' @export
occ_download_sql_validate <- function(req = NULL, user = NULL, pwd = NULL) {
stopifnot(is.list(req))
occ_download_sql_validate <- function(q = NULL,
user = NULL,
pwd = NULL) {
stopifnot(is.list(q))
url <- "https://api.gbif.org/v1/occurrence/download/request/validate"
user <- check_user(user)
pwd <- check_pwd(pwd)
out <- rg_POST(url=url, req=req, user=user, pwd=pwd, curlopts=list())
out <- rg_POST(url=url, req=q, user=user, pwd=pwd, curlopts=list())
out
}

Expand Down Expand Up @@ -94,7 +103,7 @@ occ_download_sql_prep <- function(q=NULL,
sql = unbox(q)
)

if(validate) occ_download_sql_validate(req = req, user = user, pwd = pwd)
if(validate) occ_download_sql_validate(q = req, user = user, pwd = pwd)

structure(list(
url = url,
Expand All @@ -109,8 +118,6 @@ occ_download_sql_prep <- function(q=NULL,

}

#' @name occ_download_sql
#' @export
print.occ_download_sql <- function(x) {
stopifnot(inherits(x, 'occ_download_sql'))
cat_n("<<gbif download sql>>")
Expand All @@ -136,8 +143,7 @@ print.occ_download_sql <- function(x) {
cat_n(" ", attr(x,"citation"))
}

#' @name occ_download_sql
#' @export

print.occ_download_sql_prep <- function(x) {
stopifnot(inherits(x, 'occ_download_sql_prep'))
cat_n("<<Occurrence Download SQL Prep>>")
Expand Down
21 changes: 11 additions & 10 deletions man/occ_download_sql.Rd

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

0 comments on commit 2563a57

Please sign in to comment.