Class: OnlinePayments::SDK::Logging::RequestLogMessageBuilder
- Inherits:
-
LogMessageBuilder
- Object
- LogMessageBuilder
- OnlinePayments::SDK::Logging::RequestLogMessageBuilder
- Defined in:
- lib/onlinepayments/sdk/logging/request_log_message_builder.rb
Overview
Class that converts data about a request into a properly formatted log message. Formats request id, http method, uri, headers and body into a helpful message.
Instance Attribute Summary
Attributes inherited from LogMessageBuilder
#body, #content_type, #headers, #request_id
Instance Method Summary collapse
-
#get_message ⇒ Object
Constructs and returns a log message based on the request data.
-
#initialize(request_id, method, uri) ⇒ RequestLogMessageBuilder
constructor
A new instance of RequestLogMessageBuilder.
Methods inherited from LogMessageBuilder
#add_headers, #set_body, #to_s
Constructor Details
#initialize(request_id, method, uri) ⇒ RequestLogMessageBuilder
Returns a new instance of RequestLogMessageBuilder.
8 9 10 11 12 |
# File 'lib/onlinepayments/sdk/logging/request_log_message_builder.rb', line 8 def initialize(request_id, method, uri) super(request_id) @method = method @uri = uri end |
Instance Method Details
#get_message ⇒ Object
Constructs and returns a log message based on the request data. The log message is a string.
15 16 17 18 19 20 |
# File 'lib/onlinepayments/sdk/logging/request_log_message_builder.rb', line 15 def @body ? sprintf(MSG_TEMPLATE_WITH_BODY, @request_id, empty_if_null(@method), format_uri, @headers, empty_if_null(@content_type), @body) : sprintf(MSG_TEMPLATE_WITHOUT_BODY, @request_id, empty_if_null(@method), format_uri, @headers) end |