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.



213
214
215
216
217
218
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 213

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



234
235
236
# File 'lib/ingenico/connect/sdk/logging/logging_util.rb', line 234

def self.builder
  Builder.new
end

Instance Method Details

#obfuscate(body) ⇒ Object



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

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

#obfuscate_value(key, value) ⇒ Object



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

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