Skip to content

Commit

Permalink
Codegen for openapi 1707cb8
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Mar 1, 2022
1 parent c6124db commit dedeebc
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
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

0 comments on commit dedeebc

Please sign in to comment.