Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1035

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 25 additions & 0 deletions lib/stripe/resources/test_helpers/test_clock.rb
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down