Class: PactBroker::Webhooks::HttpRequestWithRedactedHeaders

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/pact_broker/webhooks/http_request_with_redacted_headers.rb

Instance Method Summary collapse

Instance Method Details

#methodObject



12
13
14
# File 'lib/pact_broker/webhooks/http_request_with_redacted_headers.rb', line 12

def method
  __getobj__().method
end

#redact?(name) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pact_broker/webhooks/http_request_with_redacted_headers.rb', line 16

def redact? name
  PactBroker::Domain::WebhookRequest::HEADERS_TO_REDACT.any?{ | pattern | name =~ pattern }
end

#to_hashObject



6
7
8
9
10
# File 'lib/pact_broker/webhooks/http_request_with_redacted_headers.rb', line 6

def to_hash
  __getobj__().to_hash.each_with_object({}) do | (key, values), new_hash |
    new_hash[key] = redact?(key) ? ["**********"] : values
  end
end