Skip to content

Commit

Permalink
sign_lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
anniel-stripe committed Apr 14, 2023
1 parent 843bccb commit fd25364
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/stripe/request_signing_authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class RequestSigningAuthenticator

attr_reader :auth_token

def initialize(auth_token, sign_method)
def initialize(auth_token, sign_lambda)
@auth_token = case auth_token
when String
auth_token
else
raise ArgumentError, "auth_token must be a string"
end
@sign_method = sign_method
@sign_lambda = sign_lambda
end

def authenticate(method, headers, body)
Expand Down Expand Up @@ -57,7 +57,7 @@ def authenticate(method, headers, body)
end

private def sign(signature_base)
@sign_method.call(signature_base)
@sign_lambda.call(signature_base)
end

private def encoded_signature(signature_base)
Expand Down
4 changes: 2 additions & 2 deletions test/stripe/stripe_client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ class StripeClientTest < Test::Unit::TestCase
RequestSigningAuthenticator.any_instance.stubs(:encoded_signature).returns("signature")

Stripe.api_key = nil
sign_method = -> {}
Stripe.authenticator = RequestSigningAuthenticator.new("keyinfo_test_123", sign_method)
sign_lambda = -> {}
Stripe.authenticator = RequestSigningAuthenticator.new("keyinfo_test_123", sign_lambda)
end

should "apply valid signing headers for get requests" do
Expand Down

0 comments on commit fd25364

Please sign in to comment.