Skip to content

Commit

Permalink
Include latest changes from the master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
richardm-stripe committed Feb 2, 2023
2 parents b9c10b9 + 8be00fe commit 1d21c60
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
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
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 1d21c60

Please sign in to comment.