Sha256: c5befa04be00672fa566f09aa335687201e24724567dd33b54516b0160ea6b2b

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  module TestHelpers
    # 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.
    class TestClock < APIResource
      extend Stripe::APIOperations::Create
      include Stripe::APIOperations::Delete
      extend Stripe::APIOperations::List

      OBJECT_NAME = "test_helpers.test_clock"

      # Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
      def advance(params = {}, opts = {})
        request_stripe_object(
          method: :post,
          path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(self["id"]) }),
          params: params,
          opts: opts
        )
      end

      # Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
      def self.advance(test_clock, params = {}, opts = {})
        request_stripe_object(
          method: :post,
          path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(test_clock) }),
          params: params,
          opts: opts
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stripe-10.7.1 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.8.0.pre.beta.1 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.7.0 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.7.0.pre.beta.3 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.7.0.pre.beta.2 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.7.0.pre.beta.1 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.6.0 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.6.0.pre.beta.1 lib/stripe/resources/test_helpers/test_clock.rb
stripe-10.5.0 lib/stripe/resources/test_helpers/test_clock.rb