class Fonepaisa::Client
Constants
- BASE_URL
Attributes
params[R]
Public Class Methods
new(params)
click to toggle source
# File lib/fonepaisa/client.rb, line 10 def initialize(params) @params = params end
Public Instance Methods
response_valid?()
click to toggle source
# File lib/fonepaisa/client.rb, line 14 def response_valid? # if hash field is nil then no need to verify response params return true if params[:hash].nil? attributes = params.dup attributes.delete(:hash) hash_key = secure_hash_key(attributes) hash_key == params[:hash] end
Private Instance Methods
request_params()
click to toggle source
# File lib/fonepaisa/client.rb, line 37 def request_params params.merge( api_key: Fonepaisa.configuration.api_key! ) end
secure_hash_key(attributes)
click to toggle source
# File lib/fonepaisa/client.rb, line 27 def secure_hash_key(attributes) data = Fonepaisa.configuration.salt! attributes.sort.to_h.each do |_key, value| data += "|#{value.gsub(/\s+/, ' ').strip}" unless value.nil? end Digest::SHA512.hexdigest(data).upcase end