lib/elasticsearch/api/actions/cat/templates.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/cat/templates.rb in elasticsearch-api-8.13.0
- old
+ new
@@ -32,18 +32,17 @@
# @option arguments [Boolean] :help Return help information
# @option arguments [List] :s Comma-separated list of column names or column aliases to sort by
# @option arguments [Boolean] :v Verbose mode. Display column headers
# @option arguments [Hash] :headers Custom HTTP headers
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/cat-templates.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/cat-templates.html
#
def templates(arguments = {})
- request_opts = { endpoint: arguments[:endpoint] || "cat.templates" }
+ request_opts = { endpoint: arguments[:endpoint] || 'cat.templates' }
- defined_params = [:name].inject({}) do |set_variables, variable|
+ defined_params = [:name].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
- set_variables
end
request_opts[:defined_params] = defined_params unless defined_params.empty?
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
@@ -54,10 +53,10 @@
method = Elasticsearch::API::HTTP_GET
path = if _name
"_cat/templates/#{Utils.__listify(_name)}"
else
- "_cat/templates"
+ '_cat/templates'
end
params = Utils.process_params(arguments)
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)