Sha256: 685596fddcf4f1ee04cf9f9e231a804df59ff3d8d4813a7664886c65ac34b21d

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

module CurrencyCloud
  module ErrorUtils
    def platform
      base = "ruby-#{RUBY_VERSION}"
      implementation = case RUBY_ENGINE
                       when 'ruby' then ''
                       when 'jruby' then ' (jruby-#{JRUBY_VERSION})"'
                       when 'rbx' then ' (rbx-#{Rubinius::VERSION})'
                       else ' (other)'
                       end
      "#{base}#{implementation}"
    end

    REDACTED_PARAMS = [:api_key, :login_id, :token].freeze
    REDACTED_STRING = "REDACTED".freeze

    def redacted_params(params)
      redacted = params.dup

      REDACTED_PARAMS.each do |param|
        redacted[param.to_sym] = REDACTED_STRING if redacted.key? param.to_sym
        redacted[param.to_s] = REDACTED_STRING if redacted.key? param.to_s
      end

      redacted
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
currency_cloud-0.9.0 lib/currency_cloud/errors/error_utils.rb
currency_cloud-0.8.2 lib/currency_cloud/errors/error_utils.rb