Class: Logtail::Contexts::HTTP
- Inherits:
-
Logtail::Context
- Object
- Logtail::Context
- Logtail::Contexts::HTTP
- Defined in:
- lib/logtail/contexts/http.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#remote_addr ⇒ Object
readonly
Returns the value of attribute remote_addr.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ HTTP
constructor
A new instance of HTTP.
-
#to_hash ⇒ Object
Builds a hash representation containing simple objects, suitable for serialization (JSON).
Constructor Details
#initialize(attributes) ⇒ HTTP
Returns a new instance of HTTP.
9 10 11 12 13 14 15 |
# File 'lib/logtail/contexts/http.rb', line 9 def initialize(attributes) @host = attributes[:host] @method = attributes[:method] @path = attributes[:path] @remote_addr = attributes[:remote_addr] @request_id = attributes[:request_id] end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/logtail/contexts/http.rb', line 7 def host @host end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/logtail/contexts/http.rb', line 7 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/logtail/contexts/http.rb', line 7 def path @path end |
#remote_addr ⇒ Object (readonly)
Returns the value of attribute remote_addr.
7 8 9 |
# File 'lib/logtail/contexts/http.rb', line 7 def remote_addr @remote_addr end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
7 8 9 |
# File 'lib/logtail/contexts/http.rb', line 7 def request_id @request_id end |
Instance Method Details
#to_hash ⇒ Object
Builds a hash representation containing simple objects, suitable for serialization (JSON).
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logtail/contexts/http.rb', line 18 def to_hash @to_hash ||= { http: Util::NonNilHashBuilder.build do |h| h.add(:host, host) h.add(:method, method) h.add(:path, path) h.add(:remote_addr, remote_addr) h.add(:request_id, request_id) end } end |