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.



13
14
15
16
# File 'lib/logstash/modules/kibana_client.rb', line 13

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)



12
13
14
# File 'lib/logstash/modules/kibana_client.rb', line 12

def body
  @body
end

#headersObject (readonly)

to create a custom response with body as an Object (Hash or Array)



12
13
14
# File 'lib/logstash/modules/kibana_client.rb', line 12

def headers
  @headers
end

#statusObject (readonly)

to create a custom response with body as an Object (Hash or Array)



12
13
14
# File 'lib/logstash/modules/kibana_client.rb', line 12

def status
  @status
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


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

def failed?
  !succeeded?
end

#succeeded?Boolean

Returns:

  • (Boolean)


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

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