Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a few more very old deprecated methods #831

Merged
merged 1 commit into from
Aug 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ def self.set_app_info(name, partner_id: nil, url: nil, version: nil)
version: version,
}
end

# DEPRECATED. Use `Util#encode_parameters` instead.
def self.uri_encode(params)
Util.encode_parameters(params)
end
private_class_method :uri_encode
class << self
extend Gem::Deprecate
deprecate :uri_encode, "Stripe::Util#encode_parameters", 2016, 1
end
end

Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
22 changes: 0 additions & 22 deletions lib/stripe/stripe_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,6 @@ def inspect
JSON.pretty_generate(@values)
end

# Re-initializes the object based on a hash of values (usually one that's
# come back from an API call). Adds or removes value accessors as necessary
# and updates the state of internal data.
#
# Please don't use this method. If you're trying to do mass assignment, try
# #initialize_from instead.
def refresh_from(values, opts, partial = false)
initialize_from(values, opts, partial)
end
extend Gem::Deprecate
deprecate :refresh_from, "#update_attributes", 2016, 1

# Mass assigns attributes on the model.
#
# This is a version of +update_attributes+ that takes some extra options
Expand Down Expand Up @@ -271,16 +259,6 @@ def serialize_params(options = {})
update_hash
end

class << self
# This class method has been deprecated in favor of the instance method
# of the same name.
def serialize_params(obj, options = {})
obj.serialize_params(options)
end
extend Gem::Deprecate
deprecate :serialize_params, "#serialize_params", 2016, 9
end

# A protected field is one that doesn't get an accessor assigned to it
# (i.e. `obj.public = ...`) and one which is not allowed to be updated via
# the class level `Model.update(id, { ... })`.
Expand Down
28 changes: 0 additions & 28 deletions test/stripe/stripe_object_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,6 @@ def to_hash
assert_equal true, obj.send(:metaclass).method_defined?(:foo)
end

should "warn that #refresh_from is deprecated" do
old_stderr = $stderr
$stderr = StringIO.new
begin
obj = Stripe::StripeObject.construct_from({})
obj.refresh_from({}, {})
message = "NOTE: Stripe::StripeObject#refresh_from is " \
"deprecated; use #update_attributes instead"
assert_match Regexp.new(message), $stderr.string
ensure
$stderr = old_stderr
end
end

should "pass opts down to children when initializing" do
opts = { custom: "opts" }

Expand Down Expand Up @@ -475,20 +461,6 @@ class WithAdditiveObjectParam < Stripe::StripeObject
assert_equal(expected, obj.to_s)
end

should "warn that .serialize_params is deprecated" do
old_stderr = $stderr
$stderr = StringIO.new
begin
obj = Stripe::StripeObject.construct_from({})
Stripe::StripeObject.serialize_params(obj)
message = "NOTE: Stripe::StripeObject.serialize_params is " \
"deprecated; use #serialize_params instead"
assert_match Regexp.new(message), $stderr.string
ensure
$stderr = old_stderr
end
end

should "error on setting a property to an empty string" do
obj = Stripe::StripeObject.construct_from(foo: "bar")
e = assert_raises ArgumentError do
Expand Down
13 changes: 0 additions & 13 deletions test/stripe_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
require ::File.expand_path("test_helper", __dir__)

class StripeTest < Test::Unit::TestCase
should "warn that #refresh_from is deprecated" do
old_stderr = $stderr
$stderr = StringIO.new
begin
Stripe.uri_encode({})
message = "NOTE: Stripe.uri_encode is deprecated; use " \
"Stripe::Util#encode_parameters instead"
assert_match Regexp.new(message), $stderr.string
ensure
$stderr = old_stderr
end
end

should "allow app_info to be configured" do
begin
old = Stripe.app_info
Expand Down