diff --git a/DESCRIPTION b/DESCRIPTION index 9ff386b..a1917f4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -57,4 +57,4 @@ Remotes: ropensci/webmockr@httr2 X-schema.org-applicationCategory: Web X-schema.org-keywords: http, https, API, web-services, curl, mock, mocking, http-mocking, testing, testing-tools, tdd X-schema.org-isPartOf: https://ropensci.org -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/R/errors.R b/R/errors.R index 9a33f90..5006e9f 100644 --- a/R/errors.R +++ b/R/errors.R @@ -23,7 +23,7 @@ #' - but if record != once, then allow it, unless record == none #' - others? #' -#' @examples +#' @examples \dontrun{ #' vcr_configure(dir = tempdir()) #' cassettes() #' insert_cassette("turtle") @@ -53,6 +53,7 @@ #' # cleanup #' eject_cassette("turtle") #' unlink(tempdir()) +#' } UnhandledHTTPRequestError <- R6::R6Class( "UnhandledHTTPRequestError", public = list( diff --git a/R/vcr-package.R b/R/vcr-package.R index c59c41b..a2a4fd5 100644 --- a/R/vcr-package.R +++ b/R/vcr-package.R @@ -1,11 +1,3 @@ -#' vcr: Record HTTP Calls to Disk -#' -#' \pkg{vcr} records test suite 'HTTP' requests and replay them during -#' future runs. -#' -#' Check out the [http testing book](https://books.ropensci.org/http-testing/) -#' for a lot more documentation on `vcr`, `webmockr`, and `crul` -#' #' @section Backstory: #' A Ruby gem of the same name (`VCR`, ) was #' created many years ago and is the original. Ports in many languages @@ -29,7 +21,11 @@ #' #' @section Request matching: #' See [request-matching] for help on the many request matching options. -#' +#' +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start #' @importFrom R6 R6Class #' @importFrom utils getParseData #' @importFrom yaml yaml.load yaml.load_file as.yaml @@ -39,10 +35,7 @@ #' @importFrom httr http_status content #' @importFrom httr2 resp_status_desc req_perform #' @importFrom webmockr pluck_body -#' @author Scott Chamberlain -#' @docType package -#' @aliases vcr-package -#' @name vcr +## usethis namespace: end NULL #' An HTTP request as prepared by the \pkg{crul} package diff --git a/man/UnhandledHTTPRequestError.Rd b/man/UnhandledHTTPRequestError.Rd index cbb4aed..e96bcff 100644 --- a/man/UnhandledHTTPRequestError.Rd +++ b/man/UnhandledHTTPRequestError.Rd @@ -41,6 +41,7 @@ error with UnhandledHTTPRequestError } \examples{ +\dontrun{ vcr_configure(dir = tempdir()) cassettes() insert_cassette("turtle") @@ -70,6 +71,7 @@ err$match_requests_on_suggestion() # cleanup eject_cassette("turtle") unlink(tempdir()) +} \dontrun{ # vcr_last_error() } diff --git a/man/vcr-package.Rd b/man/vcr-package.Rd new file mode 100644 index 0000000..240686f --- /dev/null +++ b/man/vcr-package.Rd @@ -0,0 +1,69 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/vcr-package.R +\docType{package} +\name{vcr-package} +\alias{vcr} +\alias{vcr-package} +\title{vcr: Record 'HTTP' Calls to Disk} +\description{ +Record test suite 'HTTP' requests and replays them during future runs. A port of the Ruby gem of the same name (\url{https://github.com/vcr/vcr/}). Works by hooking into the 'webmockr' R package for matching 'HTTP' requests by various rules ('HTTP' method, 'URL', query parameters, headers, body, etc.), and then caching real 'HTTP' responses on disk in 'cassettes'. Subsequent 'HTTP' requests matching any previous requests in the same 'cassette' use a cached 'HTTP' response. +} +\section{Backstory}{ + +A Ruby gem of the same name (\code{VCR}, \url{https://github.com/vcr/vcr}) was +created many years ago and is the original. Ports in many languages +have been done. Check out that GitHub repo for all the details on +how the canonical version works. +} + +\section{Main functions}{ + +The \link{use_cassette} function is most likely what you'll want to use. It +sets the cassette you want to record to, inserts the cassette, and then +ejects the cassette, recording the interactions to the cassette. + +Instead, you can use \link{insert_cassette}, but then you have to make sure +to use \link{eject_cassette}. +} + +\section{vcr configuration}{ + +\link{vcr_configure} is the function to use to set R session wide settings. +See it's manual file for help. +} + +\section{Record modes}{ + +See \link{recording} for help on record modes. +} + +\section{Request matching}{ + +See \link{request-matching} for help on the many request matching options. +} + +\seealso{ +Useful links: +\itemize{ + \item \url{https://github.com/ropensci/vcr/ (devel) https://books.ropensci.org/http-testing/ (user manual) https://docs.ropensci.org/vcr/ (website)} + \item Report bugs at \url{https://github.com/ropensci/vcr/issues} +} + +} +\author{ +\strong{Maintainer}: Scott Chamberlain \email{sckott@protonmail.com} (\href{https://orcid.org/0000-0003-1444-9135}{ORCID}) + +Authors: +\itemize{ + \item Aaron Wolen (\href{https://orcid.org/0000-0003-2542-2202}{ORCID}) + \item Maƫlle Salmon (\href{https://orcid.org/0000-0002-2815-0399}{ORCID}) + \item Daniel Possenriede (\href{https://orcid.org/0000-0002-6738-9845}{ORCID}) +} + +Other contributors: +\itemize{ + \item rOpenSci (https://ropensci.org) [funder] +} + +} +\keyword{internal} diff --git a/man/vcr.Rd b/man/vcr.Rd deleted file mode 100644 index af7885b..0000000 --- a/man/vcr.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/vcr-package.R -\docType{package} -\name{vcr} -\alias{vcr} -\alias{vcr-package} -\title{vcr: Record HTTP Calls to Disk} -\description{ -\pkg{vcr} records test suite 'HTTP' requests and replay them during -future runs. -} -\details{ -Check out the \href{https://books.ropensci.org/http-testing/}{http testing book} -for a lot more documentation on \code{vcr}, \code{webmockr}, and \code{crul} -} -\section{Backstory}{ - -A Ruby gem of the same name (\code{VCR}, \url{https://github.com/vcr/vcr}) was -created many years ago and is the original. Ports in many languages -have been done. Check out that GitHub repo for all the details on -how the canonical version works. -} - -\section{Main functions}{ - -The \link{use_cassette} function is most likely what you'll want to use. It -sets the cassette you want to record to, inserts the cassette, and then -ejects the cassette, recording the interactions to the cassette. - -Instead, you can use \link{insert_cassette}, but then you have to make sure -to use \link{eject_cassette}. -} - -\section{vcr configuration}{ - -\link{vcr_configure} is the function to use to set R session wide settings. -See it's manual file for help. -} - -\section{Record modes}{ - -See \link{recording} for help on record modes. -} - -\section{Request matching}{ - -See \link{request-matching} for help on the many request matching options. -} - -\author{ -Scott Chamberlain -}