Sha256: 8d7f5c37288fe533f8a6846c23f5311b94f75b7e5d67e510d6ca3f60cafea0f7
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 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? begin body = JSON.load(body) rescue MultiJson::LoadError => e return body end 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
4 entries across 4 versions & 1 rubygems