class Stripe::StripeClient::ThreadContext
A record representing any data that `StripeClient` puts into `Thread.current`. Making it a class likes this gives us a little extra type safety and lets us document what each field does.
For internal use only. Does not provide a stable API and may be broken with future non-major changes.
Attributes
A `StripeClient` that's been flagged as currently active within a thread by `StripeClient#request`. A client stays active until the completion of the request block.
A default `StripeClient` object for the thread. Used in all cases where the user hasn't specified their own.
A temporary map of object IDs to responses from last executed API calls. Used to return a responses from calls to `StripeClient#request`.
Stored in the thread data to make the use of a single `StripeClient` object safe across multiple threads. Stored as a map so that multiple `StripeClient` objects can run concurrently on the same thread.
Responses are only left in as long as they're needed, which means they're removed as soon as a call leaves `StripeClient#request`, and because that's wrapped in an `ensure` block, they should never leave garbage in `Thread.current`.
Public Instance Methods
A map of connection mangers for the thread. Normally shared between all `StripeClient` objects on a particular thread, and created so as to minimize the number of open connections that an application needs.
# File lib/stripe/stripe_client.rb, line 367 def default_connection_managers @default_connection_managers ||= {} end
# File lib/stripe/stripe_client.rb, line 371 def reset_connection_managers @default_connection_managers = {} end