class Elasticsearch::API::Response

Elasticsearch client API Response object. Receives an Elastic::Transport::Transport::Response in the initializer and behaves like a Hash, except when status or headers are called upon it, in which case it returns the original object’s status and headers.

Constants

RESPONSE_METHODS

Public Class Methods

new(response) click to toggle source
# File lib/elasticsearch/api/response.rb, line 26
def initialize(response)
  @response = response
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/elasticsearch/api/response.rb, line 30
def method_missing(method, *args, &block)
  if RESPONSE_METHODS.include? method
    @response.send method.to_sym
  else
    @response.body.send(method.to_sym, *args, &block)
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
# File lib/elasticsearch/api/response.rb, line 38
def respond_to_missing?(method_name, include_private = false)
  @response.body.respond_to?(method_name, include_private) ||
    RESPONSE_METHODS.include?(method_name)
end
to_s() click to toggle source
# File lib/elasticsearch/api/response.rb, line 43
def to_s
  @response.body.to_s
end