Class: LogStash::Inputs::AkamaiSiem::Request
- Inherits:
-
Struct
- Object
- Struct
- LogStash::Inputs::AkamaiSiem::Request
- Extended by:
- MiddlewareRegistry
- Defined in:
- lib/logstash/inputs/akamai_siem/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#host ⇒ Object
Returns the value of attribute host.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#path ⇒ Object
Returns the value of attribute path.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#[](key) ⇒ Object
Value of the given header name.
- #[]=(key, value) ⇒ Object
-
#marshal_dump ⇒ Hash
Marshal serialization support.
-
#marshal_load(serialised) ⇒ Object
Marshal serialization support.
- #to_a ⇒ Object
- #update_uri(url) ⇒ Object
Methods included from MiddlewareRegistry
lookup_middleware, register_middleware, registered_middleware, unregister_middleware
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def headers @headers end |
#host ⇒ Object
Returns the value of attribute host
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def host @host end |
#http_method ⇒ Object
Returns the value of attribute http_method
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def http_method @http_method end |
#path ⇒ Object
Returns the value of attribute path
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def path @path end |
#url ⇒ Object
Returns the value of attribute url
4 5 6 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 4 def url @url end |
Class Method Details
.create(request_method) {|request| ... } ⇒ Request
15 16 17 18 19 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 15 def self.create(request_method) new(request_method).tap do |request| yield(request) if block_given? end end |
Instance Method Details
#[](key) ⇒ Object
Returns value of the given header name.
50 51 52 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 50 def [](key) headers[key] end |
#[]=(key, value) ⇒ Object
56 57 58 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 56 def []=(key, value) headers[key] = value end |
#marshal_dump ⇒ Hash
Marshal serialization support.
71 72 73 74 75 76 77 78 79 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 71 def marshal_dump { http_method: http_method, body: body, headers: headers, path: path, host: host } end |
#marshal_load(serialised) ⇒ Object
Marshal serialization support. Restores the instance variables according to the serialised
.
84 85 86 87 88 89 90 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 84 def marshal_load(serialised) self.http_method = serialised[:http_method] self.body = serialised[:body] self.headers = serialised[:headers] self.path = serialised[:path] self.host = serialised[:host] end |
#to_a ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 60 def to_a [ self.http_method, self.url.to_s, headers: self.headers ] end |
#update_uri(url) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/logstash/inputs/akamai_siem/request.rb', line 33 def update_uri(url) if url.respond_to? :query if (query = url.query) path = url.path = Addressable::URI.unencode(url.path.dup.gsub(/\/$/, '')) end else anchor_index = path.index('#') path = path.slice(0, anchor_index) unless anchor_index.nil? path, query = path.split('?', 2) end self.host = url.host self.path = path self.url = url end |