Skip to content

Commit f2a03c8

Browse files
committed
rename params dup variable to params_copy. add test. remove version bump.
1 parent 4145c74 commit f2a03c8

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

lib/emailable/client.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def initialize
1717
end
1818

1919
def request(method, endpoint, params = {})
20-
req_params = params.dup
21-
api_key = req_params.delete(:api_key)
22-
access_token = req_params.delete(:access_token)
20+
params_copy = params.dup
21+
api_key = params_copy.delete(:api_key)
22+
access_token = params_copy.delete(:access_token)
2323

2424
uri = URI("#{@base_url}/#{endpoint}")
2525
headers = {
@@ -31,12 +31,14 @@ def request(method, endpoint, params = {})
3131
tries ||= 3
3232
http_response =
3333
if method == :get
34-
uri.query = URI.encode_www_form(req_params) unless req_params.empty?
34+
unless params_copy.empty?
35+
uri.query = URI.encode_www_form(params_copy)
36+
end
3537
request = Net::HTTP::Get.new(uri, headers)
3638
@connection.request(request)
3739
elsif method == :post
3840
request = Net::HTTP::Post.new(uri, headers)
39-
request.body = req_params.to_json
41+
request.body = params_copy.to_json
4042
@connection.request(request)
4143
end
4244

lib/emailable/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Emailable
2-
VERSION = '4.2.2'
2+
VERSION = '4.2.1'
33
end

test/authentication_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ def test_request_time_authentication_takes_priority_over_global
3030
refute_nil Emailable.verify(@email, api_key: @api_key).domain
3131
end
3232

33+
def test_does_not_modify_params
34+
params = { api_key: @api_key, email: @email }
35+
Emailable.verify(params[:email], params)
36+
37+
assert_equal @api_key, params[:api_key]
38+
assert_equal @email, params[:email]
39+
end
40+
3341
end

0 commit comments

Comments
 (0)