lib/elasticsearch/api/actions/get.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/get.rb in elasticsearch-api-8.13.0
- old
+ new
@@ -36,18 +36,17 @@
# @option arguments [List] :_source_includes A list of fields to extract and return from the _source field
# @option arguments [Number] :version Explicit version number for concurrency control
# @option arguments [String] :version_type Specific version type (options: internal, external, external_gte)
# @option arguments [Hash] :headers Custom HTTP headers
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/docs-get.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/docs-get.html
#
def get(arguments = {})
- request_opts = { endpoint: arguments[:endpoint] || "get" }
+ request_opts = { endpoint: arguments[:endpoint] || 'get' }
- defined_params = [:index, :id].inject({}) do |set_variables, variable|
+ defined_params = %i[index id].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?
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
@@ -64,14 +63,14 @@
method = Elasticsearch::API::HTTP_GET
path = "#{Utils.__listify(_index)}/_doc/#{Utils.__listify(_id)}"
params = Utils.process_params(arguments)
if Array(arguments[:ignore]).include?(404)
- Utils.__rescue_from_not_found {
+ Utils.__rescue_from_not_found do
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
- }
+ end
else
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end