Skip to content

Commit 1f43fd4

Browse files
committed
🔥 Remove hacks for old Rails
1 parent aa91801 commit 1f43fd4

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

lib/oauth/request_proxy/action_controller_request.rb

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
11
# frozen_string_literal: true
22

33
require "active_support"
4-
require "active_support/version"
54
require "action_controller"
65
require "uri"
76

8-
if Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new("3")
9-
# rails 2.x
10-
require "action_controller/request"
11-
unless ActionController::Request::HTTP_METHODS.include?("patch")
12-
ActionController::Request::HTTP_METHODS << "patch"
13-
ActionController::Request::HTTP_METHOD_LOOKUP["PATCH"] = :patch
14-
ActionController::Request::HTTP_METHOD_LOOKUP["patch"] = :patch
15-
end
16-
17-
elsif Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new("4")
18-
# rails 3.x
19-
require "action_dispatch/http/request"
20-
unless ActionDispatch::Request::HTTP_METHODS.include?("patch")
21-
ActionDispatch::Request::HTTP_METHODS << "patch"
22-
ActionDispatch::Request::HTTP_METHOD_LOOKUP["PATCH"] = :patch
23-
ActionDispatch::Request::HTTP_METHOD_LOOKUP["patch"] = :patch
24-
end
25-
26-
else # rails 4.x and later - already has patch
27-
require "action_dispatch/http/request"
28-
end
7+
require "action_dispatch/http/request"
298

309
module OAuth
3110
module RequestProxy
3211
class ActionControllerRequest < OAuth::RequestProxy::Base
33-
proxies(defined?(::ActionDispatch::AbstractRequest) ? ::ActionDispatch::AbstractRequest : ::ActionDispatch::Request)
12+
proxies(::ActionDispatch::Request)
3413

3514
def method
3615
request.method.to_s.upcase
@@ -50,7 +29,7 @@ def parameters
5029
end
5130
end
5231

53-
# Override from OAuth::RequestProxy::Base to avoid roundtrip
32+
# Override from OAuth::RequestProxy::Base to avoid round-trip
5433
# conversion to Hash or Array and thus preserve the original
5534
# parameter names
5635
def parameters_for_signature

lib/oauth/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module OAuth
44
module Version
5-
VERSION = "0.6.1"
5+
VERSION = "1.0.0"
66
end
77
end

0 commit comments

Comments
 (0)