From 6e62bca84af70a5cd79c9909ecc8261b38c1babc Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 23:59:57 +0000 Subject: [PATCH] Update generated code for v828 --- OPENAPI_VERSION | 2 +- lib/stripe/resources/account.rb | 7 +++---- lib/stripe/resources/customer.rb | 5 ++--- test/stripe/generated_examples_test.rb | 28 ++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 4d2a1a3d..30af1cbc 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v827 \ No newline at end of file +v828 \ No newline at end of file diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb index 205cee8c..8e788179 100644 --- a/lib/stripe/resources/account.rb +++ b/lib/stripe/resources/account.rb @@ -24,6 +24,9 @@ module Stripe nested_resource_class_methods :capability, operations: %i[retrieve update list], resource_plural: "capabilities" + nested_resource_class_methods :external_account, + operations: %i[create retrieve update delete list] + nested_resource_class_methods :login_link, operations: %i[create] nested_resource_class_methods :person, operations: %i[create retrieve update delete list] # Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first. @@ -72,10 +75,6 @@ module Stripe save_nested_resource :external_account - nested_resource_class_methods :external_account, - operations: %i[create retrieve update delete list] - nested_resource_class_methods :login_link, operations: %i[create] - def resource_url if self["id"] super diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index d746bf71..9b63a027 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -20,8 +20,9 @@ module Stripe nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list] nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list] - nested_resource_class_methods :entitlement, operations: %i[list] + nested_resource_class_methods :source, operations: %i[create retrieve update delete list] nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list] + nested_resource_class_methods :entitlement, operations: %i[list] # Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new # funding instructions will be created. If funding instructions have already been created for a given customer, the same @@ -108,8 +109,6 @@ module Stripe end save_nested_resource :source - nested_resource_class_methods :source, - operations: %i[create retrieve update delete list] # The API request for deleting a card or bank account and for detaching a # source object are the same. diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 0224cf47..e8973eec 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -482,6 +482,14 @@ module Stripe Stripe::Customer.search({ query: "name:'fakename' AND metadata['foo']:'bar'" }) assert_requested :get, "#{Stripe.api_base}/v1/customers/search?query=name:'fakename' AND metadata['foo']:'bar'" end + should "Test customers sources delete" do + Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx") + assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx?" + end + should "Test customers sources delete 2" do + Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx") + assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?" + end should "Test customers sources get" do Stripe::Customer.list_sources( "cus_xxxxxxxxxxxxx", @@ -510,6 +518,10 @@ module Stripe Stripe::Customer.retrieve_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx") assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?" end + should "Test customers sources post" do + Stripe::Customer.update_source("cus_123", "card_123", { account_holder_name: "Kamil" }) + assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/card_123" + end should "Test customers sources post 2" do Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "btok_xxxxxxxxxxxxx" }) assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources" @@ -518,6 +530,22 @@ module Stripe Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "tok_xxxx" }) assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources" end + should "Test customers sources post 4" do + Stripe::Customer.update_source( + "cus_xxxxxxxxxxxxx", + "ba_xxxxxxxxxxxxx", + { metadata: { order_id: "6735" } } + ) + assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx" + end + should "Test customers sources post 5" do + Stripe::Customer.update_source( + "cus_xxxxxxxxxxxxx", + "card_xxxxxxxxxxxxx", + { name: "Jenny Rosen" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx" + end should "Test customers tax ids delete" do Stripe::Customer.delete_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx") assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx?"