1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cassette_class.R
\docType{data}
\name{Cassette}
\alias{Cassette}
\title{Cassette handler}
\arguments{
\item{name}{The name of the cassette. vcr will sanitize this to ensure it
is a valid file name.}
\item{record}{The record mode. Default: "once". In the future we'll support
"once", "all", "none", "new_episodes". See \link{recording} for more information}
\item{serialize_with}{(character) Which serializer to use.
Valid values are "yaml" (default), the only one supported for now.}
\item{persist_with}{(character) Which cassette persister to
use. Default: "file_system". You can also register and use a
custom persister.}
\item{match_requests_on}{List of request matchers
to use to determine what recorded HTTP interaction to replay. Defaults to
\code{["method", "uri"]}. The built-in matchers are "method", "uri", "host",
"path", "headers" and "body"}
\item{update_content_length_header}{(logical) Whether or
not to overwrite the \code{Content-Length} header of the responses to
match the length of the response body. Default: \code{FALSE}}
\item{allow_playback_repeats}{(logical) Whether or not to
allow a single HTTP interaction to be played back multiple times.
Default: \code{FALSE}.}
\item{preserve_exact_body_bytes}{(logical) Whether or not
to base64 encode the bytes of the requests and responses for
this cassette when serializing it. See also \code{preserve_exact_body_bytes}
in \code{\link[=vcr_configure]{vcr_configure()}}. Default: \code{FALSE}}
}
\value{
an object of class \code{Cassette}
}
\description{
Cassette handler
}
\details{
\strong{Methods}
\describe{
\item{\code{eject()}}{
Coming soon.
}
\item{\code{file()}}{
Get path to the man file for the cassette.
}
\item{\code{recording()}}{
Find out whether recording is happening or not.
}
\item{\code{originally_recorded_at()}}{
Time interaction was originally recorded at.
}
\item{\code{serializable_hash()}}{
A hash with stuff.
}
\item{\code{should_remove_matching_existing_interactions()}}{
Set record mode to "all".
}
\item{\code{storage_key()}}{
Generate file name = cassette name plus file extension.
}
\item{\code{make_dir()}}{
Make cassette directory.
}
\item{\code{raw_string()}}{
Get raw string of the cassette (cached interaction).
}
\item{\code{deserialized_hash()}}{
Get a deserialized hash.
}
\item{\code{make_args()}}{
Initialize default args.
}
\item{\code{write_metadata()}}{
Write metadata to disk.
}
\item{\code{previously_recorded_interactions()}}{
Coming soon.
}
\item{\code{serialize_to_crul}}{
Serialize interaction on disk/cassette to a \code{crul} response
}
}
}
\examples{
library(vcr)
vcr_configure(dir = tempdir())
res <- Cassette$new(name = "bob")
res$file()
res$originally_recorded_at()
res$recording()
res$serializable_hash()
res$eject()
res$should_remove_matching_existing_interactions()
res$storage_key()
res$match_requests_on
# record all requests
res <- Cassette$new("foobar", record = "all")
res$eject()
# cleanup
unlink(file.path(tempdir(), c("bob.yml", "foobar.yml")))
}
\seealso{
\code{\link[=vcr_configure]{vcr_configure()}}, \code{\link[=use_cassette]{use_cassette()}}, \code{\link[=insert_cassette]{insert_cassette()}}
}
\keyword{internal}
|