Compare commits

...

5 Commits

Author SHA1 Message Date
helenye-stripe
37293f6aba
Merge pull request #1311 from stripe/helenye-use-deprecation-gem-search
Use the deprecation gem in search and clean up usage of the gem
2024-01-19 10:16:03 -08:00
Helen Ye
08b00636a5 Add test to warn about search being deprecated 2024-01-18 16:46:51 -08:00
helenye-stripe
37fa3c1228
Merge branch 'master' into helenye-use-deprecation-gem-search 2024-01-18 09:40:42 -08:00
Helen Ye
faa9d58a66 Update search to use the deprecate gem 2024-01-18 09:39:17 -08:00
Helen Ye
2ac9890545 wip 2024-01-16 10:42:38 -08:00
3 changed files with 25 additions and 2 deletions

View File

@ -1,8 +1,9 @@
# frozen_string_literal: true
# TODO: (major) Deprecated, Remove along with extends
module Stripe
module APIOperations
# The _search method via API Operations is deprecated.
# Please use the search method from within the resource instead.
module Search
def _search(search_url, filters = {}, opts = {})
request_stripe_object(
@ -12,6 +13,9 @@ module Stripe
opts: opts
)
end
extend Gem::Deprecate
deprecate :_search, "request_stripe_object", 2024, 1
end
end
end

View File

@ -11,7 +11,6 @@ module Stripe
# for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express**
# below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
class Account < APIResource
extend Gem::Deprecate
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List

View File

@ -39,6 +39,26 @@ module Stripe
end
end
context ".search" do
should "warn that ._search is deprecated" do
old_stderr = $stderr
$stderr = StringIO.new
begin
stub_request(:post, "#{Stripe.api_base}/v1/customers/search?query=foo:bar")
.to_return(body: JSON.generate(object: "customer"))
client = StripeClient.new
client.request { Customer._search("/v1/customers/search", query: "foo:bar") }
message = "NOTE: Stripe::Customer._search is deprecated; use request_stripe_object " \
"instead. It will be removed on or after 2024-01."
assert_match Regexp.new(message), $stderr.string
ensure
$stderr = old_stderr
end
end
end
context ".nested_resource_class_methods" do
class MainResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock
extend Stripe::APIOperations::NestedResource