Class: Ingenico::Connect::SDK::Logging::PropertyObfuscator Deprecated

Inherits:
Obfuscator
  • Object
show all
Defined in:
lib/ingenico/connect/sdk/logging/logging_util.rb

Overview

Deprecated.

This class shouldn’t have been exposed

Class that obfuscates properties in the JSON body of a message

Defined Under Namespace

Classes: Builder

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obfuscators) ⇒ PropertyObfuscator

Returns a new instance of PropertyObfuscator.



208
209
210
211
212
213
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 208

def initialize(obfuscators)
  # case sensitive
  super(obfuscators, false)
  @obfuscation_rules = obfuscators.map { |key, value| [key, ->(v) { value.obfuscate_value(v) }]}
  @obfuscator = Obfuscation::BodyObfuscator.new(@obfuscation_rules)
end

Class Method Details

.builderObject



229
230
231
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 229

def self.builder
  Builder.new
end

Instance Method Details

#obfuscate(body) ⇒ Object



225
226
227
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 225

def obfuscate(body)
  @obfuscator.obfuscate_body(body)
end

#obfuscate_value(key, value) ⇒ Object



219
220
221
222
223
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 219

def obfuscate_value(key, value)
  obfuscation_rule = @obfuscation_rules[property_name]
  return obfuscation_rule.call(value) if obfuscation_rule
  value
end