Class: Elasticsearch::Transport::Transport::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/elasticsearch/transport/transport/response.rb

Overview

Wraps the response from Elasticsearch.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body, headers = {}) ⇒ Response

Returns a new instance of Response.

Parameters:

  • status (Integer)

    Response status code

  • body (String)

    Response body

  • headers (Hash) (defaults to: {})

    Response headers



30
31
32
33
# File 'lib/elasticsearch/transport/transport/response.rb', line 30

def initialize(status, body, headers={})
  @status, @body, @headers = status, body, headers
  @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



25
26
27
# File 'lib/elasticsearch/transport/transport/response.rb', line 25

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



25
26
27
# File 'lib/elasticsearch/transport/transport/response.rb', line 25

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



25
26
27
# File 'lib/elasticsearch/transport/transport/response.rb', line 25

def status
  @status
end