StubRegistry | R Documentation |
stub registry to keep track of StubbedRequest stubs
request_stubs
(list) list of request stubs
print()
print method for the StubRegistry
class
StubRegistry$print(x, ...)
x
self
...
ignored
register_stub()
Register a stub
StubRegistry$register_stub(stub)
stub
an object of type StubbedRequest
nothing returned; registers the stub
find_stubbed_request()
Find a stubbed request
StubRegistry$find_stubbed_request(req)
req
an object of class RequestSignature
an object of type StubbedRequest, if matched
request_stub_for()
Find a stubbed request
StubRegistry$request_stub_for(request_signature, count = TRUE)
request_signature
an object of class RequestSignature
count
(bool) iterate counter or not. default: TRUE
logical, 1 or more
remove_request_stub()
Remove a stubbed request by matching request signature
StubRegistry$remove_request_stub(stub)
stub
an object of type StubbedRequest
nothing returned; removes the stub from the registry
remove_all_request_stubs()
Remove all request stubs
StubRegistry$remove_all_request_stubs()
nothing returned; removes all request stubs
is_registered()
Find a stubbed request from a request signature
StubRegistry$is_registered(x)
x
an object of class RequestSignature
nothing returned; registers the stub
is_stubbed()
Check if a stubbed request is in the stub registry
StubRegistry$is_stubbed(stub)
stub
an object of class StubbedRequest
single boolean, TRUE
or FALSE
clone()
The objects of this class are cloneable with this method.
StubRegistry$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other stub-registry:
remove_request_stub()
,
stub_registry()
,
stub_registry_clear()
## Not run:
# Make a stub
stub1 <- StubbedRequest$new(method = "get", uri = "api.crossref.org")
stub1$with(headers = list("User-Agent" = "R"))
stub1$to_return(status = 200, body = "foobar", headers = list())
stub1
# Make another stub
stub2 <- StubbedRequest$new(method = "get", uri = "api.crossref.org")
stub2
# Put both stubs in the stub registry
reg <- StubRegistry$new()
reg$register_stub(stub = stub1)
reg$register_stub(stub = stub2)
reg
reg$request_stubs
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.