Skip to content

Commit

Permalink
fix handle_response, fix signature, fix exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
senid231 committed Jul 16, 2023
1 parent 77a5fc9 commit bf88566
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/cryptomus/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Configuration
:merchant_id,
:user_agent,
:connection_config,
:handle_response,
:on_error,
:logger

Expand Down
7 changes: 4 additions & 3 deletions lib/cryptomus/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ class ApiError < Error
# @!method response_body [Hash,nil]
attr_reader :response, :status, :response_body

# @param msg [String]
# @param response [Faraday::Response,nil]
def initialize(msg, response = nil)
# @param msg [String,nil]
def initialize(response, msg = nil)
@response = response
@status = response&.status
@response_body = response&.body
super(msg)
msg ||= "Response #{status}, #{response_body}" if response
super(msg || self.class.name)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/cryptomus/signature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Signature
# @param raw_body [String]
# @return [String]
def generate(raw_body)
raw_body_encoded = Base64.encode64(raw_body || '')
raw_body_encoded = Base64.strict_encode64(raw_body || '')
Digest::MD5.hexdigest("#{raw_body_encoded}#{Cryptomus.config.api_key}")
end
end
Expand Down

0 comments on commit bf88566

Please sign in to comment.