Class: LogStash::Modules::KibanaClient::Response
- Inherits:
-
Object
- Object
- LogStash::Modules::KibanaClient::Response
- Defined in:
- lib/logstash/modules/kibana_client.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
to create a custom response with body as an Object (Hash or Array).
-
#headers ⇒ Object
readonly
to create a custom response with body as an Object (Hash or Array).
-
#status ⇒ Object
readonly
to create a custom response with body as an Object (Hash or Array).
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(status, body, headers = {}) ⇒ Response
constructor
A new instance of Response.
- #succeeded? ⇒ Boolean
Constructor Details
#initialize(status, body, headers = {}) ⇒ Response
Returns a new instance of Response.
14 15 16 17 |
# File 'lib/logstash/modules/kibana_client.rb', line 14 def initialize(status, body, headers={}) @status, @body, @headers = status, body, headers @body = body.is_a?(String) ? LogStash::Json.load(body) : body end |
Instance Attribute Details
#body ⇒ Object (readonly)
to create a custom response with body as an Object (Hash or Array)
13 14 15 |
# File 'lib/logstash/modules/kibana_client.rb', line 13 def body @body end |
#headers ⇒ Object (readonly)
to create a custom response with body as an Object (Hash or Array)
13 14 15 |
# File 'lib/logstash/modules/kibana_client.rb', line 13 def headers @headers end |
#status ⇒ Object (readonly)
to create a custom response with body as an Object (Hash or Array)
13 14 15 |
# File 'lib/logstash/modules/kibana_client.rb', line 13 def status @status end |
Instance Method Details
#failed? ⇒ Boolean
23 24 25 |
# File 'lib/logstash/modules/kibana_client.rb', line 23 def failed? !succeeded? end |
#succeeded? ⇒ Boolean
19 20 21 |
# File 'lib/logstash/modules/kibana_client.rb', line 19 def succeeded? @status >= 200 && @status < 300 end |