Skip to content

Commit

Permalink
Codegen for openapi v155
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-stripe committed Jun 15, 2022
1 parent f2e05a2 commit e3bb30e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v154
v155
18 changes: 18 additions & 0 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ def create_funding_instructions(params = {}, opts = {})
)
end

def list_funding_instructions(params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end

def list_payment_methods(params = {}, opts = {})
request_stripe_object(
method: :get,
Expand Down Expand Up @@ -53,6 +62,15 @@ def self.create_funding_instructions(customer, params = {}, opts = {})
)
end

def self.list_funding_instructions(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
path: format("/v1/customers/%<customer>s/funding_instructions", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end

def self.list_payment_methods(customer, params = {}, opts = {})
request_stripe_object(
method: :get,
Expand Down
26 changes: 26 additions & 0 deletions lib/stripe/resources/customer_balance_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,31 @@ def self.update(_id, _params = nil, _opts = nil)
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
"Update a Customer Balance Transaction using `Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)`"
end

def test_helpers
TestHelpers.new(self)
end

class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = CustomerBalanceTransaction

def self.fund_cash_balance(customer, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(customer) }),
params: params,
opts: opts
)
end

def fund_cash_balance(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/customers/%<customer>s/fund_cash_balance", { customer: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
6 changes: 6 additions & 0 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ class CodegennedExampleTest < Test::Unit::TestCase
assert_requested :get, "#{Stripe.api_base}/v1/customers?limit=3"
end
end
context "Customer.list_funding_instructions" do
should "support requests with args: customer" do
Stripe::Customer.list_funding_instructions("cus_123")
assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/funding_instructions?"
end
end
context "Customer.list_payment_methods" do
should "support requests with args: customer, type" do
Stripe::Customer.list_payment_methods("cus_xyz", { type: "card" })
Expand Down

0 comments on commit e3bb30e

Please sign in to comment.