Module: OpenSearch::API::Common::Client

Defined Under Namespace

Modules: Base

Instance Method Summary collapse

Instance Method Details

#perform_request(method, path, params = {}, body = nil, headers = nil) ⇒ Object

Delegates the ‘perform_request` method to the wrapped client



45
46
47
# File 'lib/opensearch/api/namespace/common.rb', line 45

def perform_request(method, path, params = {}, body = nil, headers = nil)
  client.perform_request method, path, params, body, headers
end

#perform_request_complex_ignore404(method, path, params, body, headers, arguments) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/opensearch/api/namespace/common.rb', line 55

def perform_request_complex_ignore404(method, path, params, body, headers, arguments)
  if Array(arguments[:ignore]).include?(404)
    Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
  else
    perform_request(method, path, params, body, headers).body
  end
end

#perform_request_ping(method, path, params, body, headers) ⇒ Object



63
64
65
66
67
68
# File 'lib/opensearch/api/namespace/common.rb', line 63

def perform_request_ping(method, path, params, body, headers)
  perform_request(method, path, params, body, headers).status == 200
rescue StandardError => e
  raise e unless e.class.to_s =~ /NotFound|ConnectionFailed/ || e.message =~ /Not\s*Found|404|ConnectionFailed/i
  false
end

#perform_request_simple_ignore404(method, path, params, body, headers) ⇒ Object



49
50
51
52
53
# File 'lib/opensearch/api/namespace/common.rb', line 49

def perform_request_simple_ignore404(method, path, params, body, headers)
  Utils.__rescue_from_not_found do
    perform_request(method, path, params, body, headers).status == 200
  end
end