diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 70ad023ac..b7b9112ca 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -94,6 +94,7 @@ def self.object_names_to_classes Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken, Terminal::Location::OBJECT_NAME => Terminal::Location, Terminal::Reader::OBJECT_NAME => Terminal::Reader, + TestHelpers::TestClock::OBJECT_NAME => TestHelpers::TestClock, ThreeDSecure::OBJECT_NAME => ThreeDSecure, Token::OBJECT_NAME => Token, Topup::OBJECT_NAME => Topup, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 4e95f3655..7f15d9b36 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -83,6 +83,7 @@ require "stripe/resources/terminal/connection_token" require "stripe/resources/terminal/location" require "stripe/resources/terminal/reader" +require "stripe/resources/test_helpers/test_clock" require "stripe/resources/three_d_secure" require "stripe/resources/token" require "stripe/resources/topup" diff --git a/lib/stripe/resources/test_helpers/test_clock.rb b/lib/stripe/resources/test_helpers/test_clock.rb new file mode 100644 index 000000000..72ef181da --- /dev/null +++ b/lib/stripe/resources/test_helpers/test_clock.rb @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module TestHelpers + class TestClock < APIResource + extend Stripe::APIOperations::Create + include Stripe::APIOperations::Delete + extend Stripe::APIOperations::List + + OBJECT_NAME = "test_helpers.test_clock" + + custom_method :advance, http_verb: :post + + def advance(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: resource_url + "/advance", + params: params, + opts: opts + ) + end + end + end +end diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 182212e8d..9db31cd01 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -1629,6 +1629,39 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :post, "#{Stripe.api_base}/v1/tax_rates/txr_xxxxxxxxxxxxx" end end + context "TestClock.advance" do + should "support requests with args: test_clock, frozen_time" do + Stripe::TestHelpers::TestClock.advance("clock_xyz", { frozen_time: 142 }) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz/advance" + end + end + context "TestClock.create" do + should "support requests with args: frozen_time, name" do + Stripe::TestHelpers::TestClock.create( + frozen_time: 123, + name: "cogsworth" + ) + assert_requested :post, "#{Stripe.api_base}/v1/test_helpers/test_clocks" + end + end + context "TestClock.delete" do + should "support requests with args: test_clock" do + Stripe::TestHelpers::TestClock.delete("clock_xyz") + assert_requested :delete, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz?" + end + end + context "TestClock.list" do + should "work" do + Stripe::TestHelpers::TestClock.list + assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks?" + end + end + context "TestClock.retrieve" do + should "support requests with args: test_clock" do + Stripe::TestHelpers::TestClock.retrieve("clock_xyz") + assert_requested :get, "#{Stripe.api_base}/v1/test_helpers/test_clocks/clock_xyz?" + end + end context "Token.create" do should "support requests with args: card" do Stripe::Token.create(