Class: ElasticAdapter::Response

Inherits:
Decoration::Decorator show all
Defined in:
lib/elastic_adapter/response.rb

Overview

Serves to wrap the responses from elasticsearch

Instance Attribute Summary

Attributes inherited from Decoration::Decorator

#original_object

Instance Method Summary collapse

Methods inherited from Decoration::Decorator

#initialize, #object

Constructor Details

This class inherits a constructor from ElasticAdapter::Decoration::Decorator

Instance Method Details

#decorateDecorator

Decorates the response with the right decorator

Returns:

  • (Decorator)

    returns the decorated response


21
22
23
# File 'lib/elastic_adapter/response.rb', line 21

def decorate
  Decoration::ResponseDecoratorFactory.decorate(self)
end

#failure?Boolean

Checks if the operation failed

Returns:

  • (Boolean)

14
15
16
# File 'lib/elastic_adapter/response.rb', line 14

def failure?
  key?(:exception)
end

#success?Boolean

Checks if the operation was successfull

Returns:

  • (Boolean)

7
8
9
# File 'lib/elastic_adapter/response.rb', line 7

def success?
  !failure?
end