Sha256: d6aee30a065e8ec19f892b3547a08c50e40a917107b338f9c53b08dcf9b0597f
Contents?: true
Size: 1.03 KB
Versions: 10
Compression:
Stored size: 1.03 KB
Contents
module MangoPay module FilterParameters def self.request(body) begin body = JSON.load(body) rescue MultiJson::LoadError => e return body end filter_hash(body, req_confidential_params) JSON.dump(body) end def self.response(body) return '' if body.to_s.empty? body = JSON.load(body) filter_hash(body, res_confidential_params) JSON.dump(body) end private def self.filter_hash(hash, to_filter) hash.each do |k,v| if v.is_a?(Hash) filter_hash(v, to_filter) else hash[k] = '[FILTERED]' if to_filter.include?(k) end end end def self.res_confidential_params @@res_confidential_params ||= [ 'access_token', 'AccessKey', 'IBAN', 'CardRegistrationURL', 'PreregistrationData', 'RedirectURL', 'RegistrationData', 'SecureModeRedirectUrl' ].freeze end def self.req_confidential_params @@req_confidential_params ||= ['File', 'IBAN'].freeze end end end
Version data entries
10 entries across 10 versions & 1 rubygems