Class: LogStash::Modules::KibanaClient::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/modules/kibana_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (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

#headersObject (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

#statusObject (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

Returns:

  • (Boolean)


23
24
25
# File 'lib/logstash/modules/kibana_client.rb', line 23

def failed?
  !succeeded?
end

#succeeded?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/logstash/modules/kibana_client.rb', line 19

def succeeded?
  @status >= 200 && @status < 300
end