diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d9071b5..aad0ae7f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 8.2.0 - 2023-02-02 +* [#1173](https://github.com/stripe/stripe-ruby/pull/1173) API Updates + * Add support for `resume` method on resource `Subscription` +* [#1171](https://github.com/stripe/stripe-ruby/pull/1171) Remove unused `partial` param from `initialize_from` + ## 8.2.0-beta.3 - 2023-01-26 * [#1172](https://github.com/stripe/stripe-ruby/pull/1172) API Updates for beta branch * Updated stable APIs to the latest version diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 73d5d6e51..4e134f2a9 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v221 \ No newline at end of file +v223 \ No newline at end of file diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 3ad4b7ed5..e4e668357 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -51,7 +51,9 @@ def self.object_names_to_classes FinancialConnections::AccountOwner::OBJECT_NAME => FinancialConnections::AccountOwner, FinancialConnections::AccountOwnership::OBJECT_NAME => FinancialConnections::AccountOwnership, + FinancialConnections::InferredBalance::OBJECT_NAME => FinancialConnections::InferredBalance, FinancialConnections::Session::OBJECT_NAME => FinancialConnections::Session, + FinancialConnections::Transaction::OBJECT_NAME => FinancialConnections::Transaction, FundingInstructions::OBJECT_NAME => FundingInstructions, GiftCards::Card::OBJECT_NAME => GiftCards::Card, GiftCards::Transaction::OBJECT_NAME => GiftCards::Transaction, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 3442d3bb5..b19511c42 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -38,7 +38,9 @@ require "stripe/resources/financial_connections/account" require "stripe/resources/financial_connections/account_owner" require "stripe/resources/financial_connections/account_ownership" +require "stripe/resources/financial_connections/inferred_balance" require "stripe/resources/financial_connections/session" +require "stripe/resources/financial_connections/transaction" require "stripe/resources/funding_instructions" require "stripe/resources/gift_cards/card" require "stripe/resources/gift_cards/transaction" diff --git a/lib/stripe/resources/financial_connections/account.rb b/lib/stripe/resources/financial_connections/account.rb index 90c9950f3..e20af530e 100644 --- a/lib/stripe/resources/financial_connections/account.rb +++ b/lib/stripe/resources/financial_connections/account.rb @@ -6,9 +6,12 @@ module FinancialConnections # A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access. class Account < APIResource extend Stripe::APIOperations::List + extend Stripe::APIOperations::NestedResource OBJECT_NAME = "financial_connections.account" + nested_resource_class_methods :inferred_balance, operations: %i[list] + def disconnect(params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/financial_connections/inferred_balance.rb b/lib/stripe/resources/financial_connections/inferred_balance.rb new file mode 100644 index 000000000..2870e8cb2 --- /dev/null +++ b/lib/stripe/resources/financial_connections/inferred_balance.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module FinancialConnections + # A historical balance for the account on a particular day. It may be sourced from a balance snapshot provided by a financial institution, or inferred using transactions data. + class InferredBalance < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "financial_connections.account_inferred_balance" + end + end +end diff --git a/lib/stripe/resources/financial_connections/transaction.rb b/lib/stripe/resources/financial_connections/transaction.rb new file mode 100644 index 000000000..64d5d0c68 --- /dev/null +++ b/lib/stripe/resources/financial_connections/transaction.rb @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module FinancialConnections + # A Transaction represents a real transaction that affects a Financial Connections Account balance. + class Transaction < APIResource + extend Stripe::APIOperations::List + + OBJECT_NAME = "financial_connections.transaction" + end + end +end diff --git a/lib/stripe/resources/subscription.rb b/lib/stripe/resources/subscription.rb index ee14a68f0..62d11f053 100644 --- a/lib/stripe/resources/subscription.rb +++ b/lib/stripe/resources/subscription.rb @@ -31,6 +31,15 @@ def delete_discount(params = {}, opts = {}) ) end + def resume(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/subscriptions/%s/resume", { subscription: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + def self.cancel(subscription_exposed_id, params = {}, opts = {}) request_stripe_object( method: :delete, @@ -49,6 +58,15 @@ def self.delete_discount(subscription_exposed_id, params = {}, opts = {}) ) end + def self.resume(subscription, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/subscriptions/%s/resume", { subscription: CGI.escape(subscription) }), + params: params, + opts: opts + ) + end + save_nested_resource :source def self.search(params = {}, opts = {}) diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 471525533..f575c461e 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -1876,6 +1876,15 @@ class CodegennedExampleTest < Test::Unit::TestCase assert_requested :get, "#{Stripe.api_base}/v1/subscriptions?limit=3" end end + context "Subscription.resume" do + should "support requests with args: id, proration_date, proration_behavior" do + Stripe::Subscription.resume( + "sub_xxxxxxxxxxxxx", + { proration_date: 1_675_400_000, proration_behavior: "always_invoice" } + ) + assert_requested :post, "#{Stripe.api_base}/v1/subscriptions/sub_xxxxxxxxxxxxx/resume" + end + end context "Subscription.retrieve" do should "support requests with args: id" do Stripe::Subscription.retrieve("sub_xxxxxxxxxxxxx")