HashCounter {webmockr}R Documentation

HashCounter

Description

hash with counter, to store requests, and count each time it is used

Public fields

hash

(list) a list for internal use only, with elements key, sig, and count

Methods

Public methods


Method put()

Register a request by it's key

Usage
HashCounter$put(req_sig)
Arguments
req_sig

an object of class RequestSignature

Returns

nothing returned; registers request and iterates internal counter


Method get()

Get a request by key

Usage
HashCounter$get(req_sig)
Arguments
req_sig

an object of class RequestSignature

Returns

(integer) the count of how many times the request has been made


Method clone()

The objects of this class are cloneable with this method.

Usage
HashCounter$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other request-registry: RequestRegistry, request_registry()

Examples

x <- HashCounter$new()
x$hash
z <- RequestSignature$new(method = "get", uri = "https:/httpbin.org/get")
x$put(z)
x$hash
x$get(z)
x$put(z)
x$get(z)

[Package webmockr version 1.0.0 Index]