Class: BlueprintAgreement::Utils::RequestLogger

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/blueprint_agreement/utils/request_logger.rb

Instance Method Summary collapse

Instance Method Details

#for(body:, headers:, path:, request_method:) ⇒ Object



8
9
10
11
12
13
# File 'lib/blueprint_agreement/utils/request_logger.rb', line 8

def for(body:, headers:, path:, request_method:)
  @body = body
  @path = path
  @request_method = request_method
  @headers = headers
end


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/blueprint_agreement/utils/request_logger.rb', line 15

def print
  header_output =  @headers.to_a.map { |header| header.join(": ") }.join("\n")
  %{
Method: #{@request_method}
Path: #{@path}

Headers:
#{ header_output }

Body:
#{@body}
  }
end