Deprecate save method

This commit is contained in:
Annie Li 2022-10-18 15:19:43 -07:00
parent bb48bff819
commit f300f357ee

View File

@ -50,6 +50,9 @@ module Stripe
# idempotency_key to be passed in the request headers, or for the # idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See # api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}. # {APIOperations::Request.execute_resource_request}.
#
# This method is DEPRECATED and for backwards compatibility only.
# Use the update method with the resource ID instead.
def save(params = {}, opts = {}) def save(params = {}, opts = {})
# We started unintentionally (sort of) allowing attributes sent to # We started unintentionally (sort of) allowing attributes sent to
# +save+ to override values used during the update. So as not to break # +save+ to override values used during the update. So as not to break
@ -68,6 +71,8 @@ module Stripe
resp, opts = execute_resource_request(:post, save_url, values, opts) resp, opts = execute_resource_request(:post, save_url, values, opts)
initialize_from(resp.data, opts) initialize_from(resp.data, opts)
end end
extend Gem::Deprecate
deprecate :save, :none, 2022, 11
def self.included(base) def self.included(base)
# Set `metadata` as additive so that when it's set directly we remember # Set `metadata` as additive so that when it's set directly we remember