lib/elasticsearch/api/actions/machine_learning/close_job.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/machine_learning/close_job.rb in elasticsearch-api-8.13.0

- old
+ new

@@ -29,17 +29,16 @@ # @option arguments [Boolean] :force True if the job should be forcefully closed # @option arguments [Time] :timeout Controls the time to wait until a job has closed. Default to 30 minutes # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The URL params optionally sent in the body # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-close-job.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/ml-close-job.html # def close_job(arguments = {}) - request_opts = { endpoint: arguments[:endpoint] || "ml.close_job" } + request_opts = { endpoint: arguments[:endpoint] || 'ml.close_job' } - defined_params = [:job_id].inject({}) do |set_variables, variable| + defined_params = [:job_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 'job_id' missing" unless arguments[:job_id]