View Source Stripe.TestHelpers.TestClock (Striped v0.1.0)
A test clock enables deterministic control over objects in testmode. With a test clock, you can create objects at a frozen time in the past or future, and advance to a specific future time to observe webhooks and state changes. After the clock advances, you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time.
Link to this section Summary
Functions
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
Creates a new test clock that can be attached to new customers and quotes.
Deletes a test clock.
Returns a list of your test clocks.
Retrieves a test clock.
Link to this section Types
@type t() :: %Stripe.TestHelpers.TestClock{ created: integer(), deletes_after: integer(), frozen_time: integer(), id: binary(), livemode: boolean(), name: binary() | nil, object: binary(), status: binary() }
The test_helpers.test_clock type.
createdTime at which the object was created. Measured in seconds since the Unix epoch.deletes_afterTime at which this clock is scheduled to auto delete.frozen_timeTime at which all objects belonging to this clock are frozen.idUnique identifier for the object.livemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.nameThe custom name supplied at creation.objectString representing the object's type. Objects of the same type share the same value.statusThe status of the Test Clock.
Link to this section Functions
@spec advance(client :: term(), test_clock :: binary(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
Details
- Method:
post - Path:
/v1/test_helpers/test_clocks/{test_clock}/advance
@spec create(client :: term(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a new test clock that can be attached to new customers and quotes.
Details
- Method:
post - Path:
/v1/test_helpers/test_clocks
@spec delete(client :: term(), test_clock :: binary()) :: {:ok, Stripe.DeletedTestHelpers.TestClock.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Deletes a test clock.
Details
- Method:
delete - Path:
/v1/test_helpers/test_clocks/{test_clock}
@spec list(client :: term(), params :: map()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of your test clocks.
Details
- Method:
get - Path:
/v1/test_helpers/test_clocks
Query parameters
:ending_beforestring:expandarray of: string:limitinteger:starting_afterstring
@spec retrieve(client :: term(), test_clock :: binary(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a test clock.
Details
- Method:
get - Path:
/v1/test_helpers/test_clocks/{test_clock}
Query parameters
:expandarray of: string