Skip to content

Commit

Permalink
Merge pull request #1174 from stripe/latest-codegen-beta
Browse files Browse the repository at this point in the history
API Updates for beta branch
  • Loading branch information
richardm-stripe authored Feb 2, 2023
2 parents 446ffc7 + d10398a commit ff853fd
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v221
v223
2 changes: 2 additions & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions lib/stripe/resources/financial_connections/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 13 additions & 0 deletions lib/stripe/resources/financial_connections/inferred_balance.rb
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions lib/stripe/resources/financial_connections/transaction.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions lib/stripe/resources/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ def delete_discount(params = {}, opts = {})
)
end

def resume(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/subscriptions/%<subscription>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,
Expand All @@ -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/%<subscription>s/resume", { subscription: CGI.escape(subscription) }),
params: params,
opts: opts
)
end

save_nested_resource :source

def self.search(params = {}, opts = {})
Expand Down
9 changes: 9 additions & 0 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ff853fd

Please sign in to comment.