Class: OpenSearch::Client

Inherits:
Object
  • Object
show all
Includes:
API
Defined in:
lib/opensearch.rb

Constant Summary

Constants included from API

API::COMMON_PARAMS, API::COMMON_QUERY_PARAMS, API::DEFAULT_DOC, API::DEFAULT_SERIALIZER, API::HTTP_DELETE, API::HTTP_GET, API::HTTP_HEAD, API::HTTP_PATCH, API::HTTP_POST, API::HTTP_PUT, API::UNDERSCORE_ALL, API::UNDERSCORE_SEARCH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API

included, serializer, settings

Constructor Details

#initialize(arguments = {}, &block) ⇒ Client

See OpenSearch::Transport::Client for initializer parameters



40
41
42
43
# File 'lib/opensearch.rb', line 40

def initialize(arguments = {}, &block)
  @verified = false
  @transport = OpenSearch::Transport::Client.new(arguments, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



45
46
47
48
49
# File 'lib/opensearch.rb', line 45

def method_missing(name, *args, &block)
  return super unless name == :perform_request
  verify_open_search unless @verified
  @transport.perform_request(*args, &block)
end

Instance Attribute Details

#transportObject

Returns the value of attribute transport.



37
38
39
# File 'lib/opensearch.rb', line 37

def transport
  @transport
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/opensearch.rb', line 51

def respond_to_missing?(method_name, include_private = false)
  name == :perform_request || super
end