From 58dfe95e85e7f673161480d1f8bb1e713a5b6743 Mon Sep 17 00:00:00 2001 From: Neil Donewar Date: Tue, 5 Dec 2023 18:15:57 +0000 Subject: [PATCH 1/4] Use .ruby-version --- .gitignore | 1 - .ruby-version | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .ruby-version diff --git a/.gitignore b/.gitignore index b420a982..d64dd0aa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ /vendor/gems /.bundle /.rbenv-version -/.ruby-version /vendor/cache/*.gem /coverage Gemfile.lock diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..be94e6f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.2 From ce36e5337aac4efc2c3097836bc0ee8fcd1545c2 Mon Sep 17 00:00:00 2001 From: Neil Donewar Date: Tue, 5 Dec 2023 18:18:49 +0000 Subject: [PATCH 2/4] Autocorrected changes --- lib/elastomer_client/client.rb | 12 ++++++------ lib/elastomer_client/client/bulk.rb | 2 +- lib/elastomer_client/client/cluster.rb | 6 +++--- lib/elastomer_client/client/docs.rb | 12 ++++++------ lib/elastomer_client/client/index.rb | 14 +++++++------- lib/elastomer_client/client/multi_percolate.rb | 6 +++--- lib/elastomer_client/client/multi_search.rb | 2 +- lib/elastomer_client/client/nodes.rb | 2 +- lib/elastomer_client/client/percolator.rb | 4 ++-- lib/elastomer_client/client/repository.rb | 4 ++-- .../client/rest_api_spec/api_spec.rb | 4 ++-- lib/elastomer_client/client/scroller.rb | 2 +- lib/elastomer_client/client/snapshot.rb | 8 ++++---- lib/elastomer_client/client/tasks.rb | 4 ++-- lib/elastomer_client/notifications.rb | 2 +- test/client/errors_test.rb | 2 +- test/client/index_test.rb | 2 +- test/client/native_delete_by_query_test.rb | 2 +- test/client/rest_api_spec/api_spec_test.rb | 2 +- test/client/update_by_query_test.rb | 2 +- test/middleware/encode_json_test.rb | 2 +- test/middleware/parse_json_test.rb | 2 +- test/test_helper.rb | 2 +- 23 files changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/elastomer_client/client.rb b/lib/elastomer_client/client.rb index df1225f8..c0461ae0 100644 --- a/lib/elastomer_client/client.rb +++ b/lib/elastomer_client/client.rb @@ -86,12 +86,12 @@ def initialize(host: "localhost", port: 9200, url: nil, # fashion. def dup self.class.new \ - url: url, - read_timeout: read_timeout, - open_timeout: open_timeout, + url:, + read_timeout:, + open_timeout:, adapter: @adapter, opaque_id: @opaque_id, - max_request_size: max_request_size, + max_request_size:, basic_auth: @basic_auth, token_auth: @token_auth end @@ -144,8 +144,8 @@ def connection conn.use(:gzip) conn.request(:encode_json) conn.request(:opaque_id) if @opaque_id - conn.request(:limit_size, max_request_size: max_request_size) if max_request_size - conn.request(:elastomer_compress, compression: compression) if compress_body + conn.request(:limit_size, max_request_size:) if max_request_size + conn.request(:elastomer_compress, compression:) if compress_body conn.options[:timeout] = read_timeout conn.options[:open_timeout] = open_timeout diff --git a/lib/elastomer_client/client/bulk.rb b/lib/elastomer_client/client/bulk.rb index 59931eab..70400734 100644 --- a/lib/elastomer_client/client/bulk.rb +++ b/lib/elastomer_client/client/bulk.rb @@ -39,7 +39,7 @@ def bulk(body = nil, params = nil) else raise "bulk request body cannot be nil" if body.nil? params ||= {} - updated_params = params.merge(body: body, action: "bulk", rest_api: "bulk") + updated_params = params.merge(body:, action: "bulk", rest_api: "bulk") updated_params.delete(:type) if version_support.es_version_8_plus? response = self.post "{/index}{/type}/_bulk", updated_params diff --git a/lib/elastomer_client/client/cluster.rb b/lib/elastomer_client/client/cluster.rb index c8ad2895..2e52681a 100644 --- a/lib/elastomer_client/client/cluster.rb +++ b/lib/elastomer_client/client/cluster.rb @@ -119,7 +119,7 @@ def get_settings(params = {}) # # Returns the response as a Hash def update_settings(body, params = {}) - response = client.put "/_cluster/settings", params.merge(body: body, action: "cluster.update_settings", rest_api: "cluster.put_settings") + response = client.put "/_cluster/settings", params.merge(body:, action: "cluster.update_settings", rest_api: "cluster.put_settings") response.body end @@ -159,7 +159,7 @@ def reroute(commands, params = {}) body = {commands: Array(commands)} end - response = client.post "/_cluster/reroute", params.merge(body: body, action: "cluster.reroute", rest_api: "cluster.reroute") + response = client.post "/_cluster/reroute", params.merge(body:, action: "cluster.reroute", rest_api: "cluster.reroute") response.body end @@ -217,7 +217,7 @@ def update_aliases(actions, params = {}) body = {actions: Array(actions)} end - response = client.post "/_aliases", params.merge(body: body, action: "cluster.update_aliases", rest_api: "indices.update_aliases") + response = client.post "/_aliases", params.merge(body:, action: "cluster.update_aliases", rest_api: "indices.update_aliases") response.body end diff --git a/lib/elastomer_client/client/docs.rb b/lib/elastomer_client/client/docs.rb index 3d297e14..c6ef3a12 100644 --- a/lib/elastomer_client/client/docs.rb +++ b/lib/elastomer_client/client/docs.rb @@ -310,7 +310,7 @@ def update_by_query(query, params = nil) # # Returns the response body as a Hash def percolate(body, params = {}) - response = client.get "/{index}/{type}{/id}/_percolate", update_params(params, body: body, action: "percolator.percolate", rest_api: "percolate") + response = client.get "/{index}/{type}{/id}/_percolate", update_params(params, body:, action: "percolator.percolate", rest_api: "percolate") response.body end @@ -326,7 +326,7 @@ def percolate(body, params = {}) # # Returns the count def percolate_count(body, params = {}) - response = client.get "/{index}/{type}{/id}/_percolate/count", update_params(params, body: body, action: "percolator.percolate_count", rest_api: "count_percolate") + response = client.get "/{index}/{type}{/id}/_percolate/count", update_params(params, body:, action: "percolator.percolate_count", rest_api: "count_percolate") response.body["total"] end @@ -363,7 +363,7 @@ def termvector(params = {}) # # Returns the response body as a hash def multi_termvectors(body, params = {}) - response = client.get "{/index}{/type}/_mtermvectors", update_params(params, {body: body, action: "docs.multi_termvectors", rest_api: "mtermvectors"}, client.version_support.es_version_8_plus?) + response = client.get "{/index}{/type}/_mtermvectors", update_params(params, {body:, action: "docs.multi_termvectors", rest_api: "mtermvectors"}, client.version_support.es_version_8_plus?) response.body end alias_method :multi_term_vectors, :multi_termvectors @@ -473,7 +473,7 @@ def bulk(params = {}, &block) # # Returns a new Scroller instance def scroll(query, opts = {}) - opts = {index: name, type: type}.merge opts + opts = {index: name, type:}.merge opts client.scroll query, opts end @@ -500,7 +500,7 @@ def scroll(query, opts = {}) # # Returns a new Scroller instance def scan(query, opts = {}) - opts = {index: name, type: type}.merge opts + opts = {index: name, type:}.merge opts client.scan query, opts end @@ -610,7 +610,7 @@ def update_params(params, overrides = nil, delete_type = false) # Internal: Returns a Hash containing default parameters. def defaults - { index: name, type: type } + { index: name, type: } end # Internal: Allow params to be passed as the first argument to diff --git a/lib/elastomer_client/client/index.rb b/lib/elastomer_client/client/index.rb index e3b50b23..273486f2 100644 --- a/lib/elastomer_client/client/index.rb +++ b/lib/elastomer_client/client/index.rb @@ -56,7 +56,7 @@ def exists?(params = {}) # # Returns the response body as a Hash def create(body, params = {}) - response = client.put "/{index}", update_params(params, body: body, action: "index.create", rest_api: "indices.create") + response = client.put "/{index}", update_params(params, body:, action: "index.create", rest_api: "indices.create") response.body end @@ -118,7 +118,7 @@ def get_settings(params = {}) # # Returns the response body as a Hash def update_settings(body, params = {}) - response = client.put "{/index}/_settings", update_params(params, body: body, action: "index.update_settings", rest_api: "indices.put_settings") + response = client.put "{/index}/_settings", update_params(params, body:, action: "index.update_settings", rest_api: "indices.put_settings") response.body end @@ -147,7 +147,7 @@ def get_mapping(params = {}) # # Returns the response body as a Hash def update_mapping(type, body, params = {}) - response = client.put "/{index}/_mapping{/type}", update_params(params, body: body, type: type, action: "index.update_mapping", rest_api: "indices.put_mapping") + response = client.put "/{index}/_mapping{/type}", update_params(params, body:, type:, action: "index.update_mapping", rest_api: "indices.put_mapping") response.body end alias_method :put_mapping, :update_mapping @@ -181,7 +181,7 @@ def get_aliases(params = {}) # # Returns the response body as a Hash def get_alias(name, params = {}) - response = client.get "/{index}/_alias/{name}", update_params(params, name: name, action: "index.get_alias", rest_api: "indices.get_alias") + response = client.get "/{index}/_alias/{name}", update_params(params, name:, action: "index.get_alias", rest_api: "indices.get_alias") response.body end @@ -200,7 +200,7 @@ def get_alias(name, params = {}) # # Returns the response body as a Hash def add_alias(name, params = {}) - response = client.put "/{index}/_alias/{name}", update_params(params, name: name, action: "index.add_alias", rest_api: "indices.put_alias") + response = client.put "/{index}/_alias/{name}", update_params(params, name:, action: "index.add_alias", rest_api: "indices.put_alias") response.body end @@ -218,7 +218,7 @@ def add_alias(name, params = {}) # # Returns the response body as a Hash def delete_alias(name, params = {}) - response = client.delete "/{index}/_alias/{name}", update_params(params, name: name, action: "index.delete_alias", rest_api: "indices.delete_alias") + response = client.delete "/{index}/_alias/{name}", update_params(params, name:, action: "index.delete_alias", rest_api: "indices.delete_alias") response.body end @@ -233,7 +233,7 @@ def delete_alias(name, params = {}) # Returns the response body as a Hash def analyze(text, params = {}) body = text.is_a?(Hash) ? text : {text: text.to_s} - response = client.get "{/index}/_analyze", update_params(params, body: body, action: "index.analyze", rest_api: "indices.analyze") + response = client.get "{/index}/_analyze", update_params(params, body:, action: "index.analyze", rest_api: "indices.analyze") response.body end diff --git a/lib/elastomer_client/client/multi_percolate.rb b/lib/elastomer_client/client/multi_percolate.rb index 68e79a2c..89458d76 100644 --- a/lib/elastomer_client/client/multi_percolate.rb +++ b/lib/elastomer_client/client/multi_percolate.rb @@ -42,7 +42,7 @@ def multi_percolate(body = nil, params = nil) raise "multi_percolate request body cannot be nil" if body.nil? params ||= {} - response = self.post "{/index}{/type}/_mpercolate", params.merge(body: body, action: "mpercolate", rest_api: "mpercolate") + response = self.post "{/index}{/type}/_mpercolate", params.merge(body:, action: "mpercolate", rest_api: "mpercolate") response.body end end @@ -83,7 +83,7 @@ def initialize(client, params = {}) # Returns this MultiPercolate instance. def percolate(doc, header = {}) add_to_actions(percolate: @params.merge(header)) - add_to_actions(doc: doc) + add_to_actions(doc:) end # Add a percolate acount action to the multi percolate request. This @@ -96,7 +96,7 @@ def percolate(doc, header = {}) # Returns this MultiPercolate instance. def count(doc, header = {}) add_to_actions(count: @params.merge(header)) - add_to_actions(doc: doc) + add_to_actions(doc:) end # Execute the multi_percolate call with the accumulated percolate actions. diff --git a/lib/elastomer_client/client/multi_search.rb b/lib/elastomer_client/client/multi_search.rb index 9fc21591..08703e9e 100644 --- a/lib/elastomer_client/client/multi_search.rb +++ b/lib/elastomer_client/client/multi_search.rb @@ -42,7 +42,7 @@ def multi_search(body = nil, params = nil) raise "multi_search request body cannot be nil" if body.nil? params ||= {} - response = self.post "{/index}{/type}/_msearch", params.merge(body: body, action: "msearch", rest_api: "msearch") + response = self.post "{/index}{/type}/_msearch", params.merge(body:, action: "msearch", rest_api: "msearch") response.body end end diff --git a/lib/elastomer_client/client/nodes.rb b/lib/elastomer_client/client/nodes.rb index 708e091e..4a8d6b23 100644 --- a/lib/elastomer_client/client/nodes.rb +++ b/lib/elastomer_client/client/nodes.rb @@ -100,7 +100,7 @@ def hot_threads(params = {}) # # Returns a new params Hash. def update_params(params, overrides = nil) - h = { node_id: node_id }.update params + h = { node_id: }.update params h.update overrides unless overrides.nil? h end diff --git a/lib/elastomer_client/client/percolator.rb b/lib/elastomer_client/client/percolator.rb index f14c2345..49fd7c07 100644 --- a/lib/elastomer_client/client/percolator.rb +++ b/lib/elastomer_client/client/percolator.rb @@ -27,7 +27,7 @@ def initialize(client, index_name, id) # # Returns the response body as a Hash def create(body, params = {}) - response = client.put("/{index}/percolator/{id}", defaults.merge(params.merge(body: body, action: "percolator.create"))) + response = client.put("/{index}/percolator/{id}", defaults.merge(params.merge(body:, action: "percolator.create"))) response.body end @@ -71,7 +71,7 @@ def exists?(params = {}) # Internal: Returns a Hash containing default parameters. def defaults - {index: index_name, id: id} + {index: index_name, id:} end end # Percolator diff --git a/lib/elastomer_client/client/repository.rb b/lib/elastomer_client/client/repository.rb index 1479f556..4a1d3e94 100644 --- a/lib/elastomer_client/client/repository.rb +++ b/lib/elastomer_client/client/repository.rb @@ -47,7 +47,7 @@ def exists?(params = {}) # # Returns the response body as a Hash def create(body, params = {}) - response = client.put "/_snapshot/{repository}", update_params(params, body: body, action: "repository.create", rest_api: "snapshot.create_repository") + response = client.put "/_snapshot/{repository}", update_params(params, body:, action: "repository.create", rest_api: "snapshot.create_repository") response.body end @@ -81,7 +81,7 @@ def status(params = {}) # # Returns the response body as a Hash def update(body, params = {}) - response = client.put "/_snapshot/{repository}", update_params(params, body: body, action: "repository.update", rest_api: "snapshot.create_repository") + response = client.put "/_snapshot/{repository}", update_params(params, body:, action: "repository.update", rest_api: "snapshot.create_repository") response.body end diff --git a/lib/elastomer_client/client/rest_api_spec/api_spec.rb b/lib/elastomer_client/client/rest_api_spec/api_spec.rb index 24298c29..601d61a2 100644 --- a/lib/elastomer_client/client/rest_api_spec/api_spec.rb +++ b/lib/elastomer_client/client/rest_api_spec/api_spec.rb @@ -27,7 +27,7 @@ def initialize def select_params(api:, from:) rest_api = get(api) return from if rest_api.nil? - rest_api.select_params(from: from) + rest_api.select_params(from:) end # Given an API descriptor name and a single request parameter, returns @@ -54,7 +54,7 @@ def valid_param?(api:, param:) def select_parts(api:, from:) rest_api = get(api) return from if rest_api.nil? - rest_api.select_parts(from: from) + rest_api.select_parts(from:) end # Given an API descriptor name and a single path part, returns `true` if the diff --git a/lib/elastomer_client/client/scroller.rb b/lib/elastomer_client/client/scroller.rb index 96727e59..088019f1 100644 --- a/lib/elastomer_client/client/scroller.rb +++ b/lib/elastomer_client/client/scroller.rb @@ -98,7 +98,7 @@ def start_scroll(opts = {}) # # Returns the response body as a Hash. def continue_scroll(scroll_id, scroll = "5m") - response = get "/_search/scroll", body: {scroll_id: scroll_id}, scroll: scroll, action: "search.scroll", rest_api: "scroll" + response = get "/_search/scroll", body: {scroll_id:}, scroll:, action: "search.scroll", rest_api: "scroll" response.body rescue RequestError => err if err.error && err.error["caused_by"]["type"] == "search_context_missing_exception" diff --git a/lib/elastomer_client/client/snapshot.rb b/lib/elastomer_client/client/snapshot.rb index 13e589cf..f130048f 100644 --- a/lib/elastomer_client/client/snapshot.rb +++ b/lib/elastomer_client/client/snapshot.rb @@ -56,7 +56,7 @@ def exists?(params = {}) # # Returns the response body as a Hash def create(body = {}, params = {}) - response = client.put "/_snapshot/{repository}/{snapshot}", update_params(params, body: body, action: "snapshot.create", rest_api: "snapshot.create") + response = client.put "/_snapshot/{repository}/{snapshot}", update_params(params, body:, action: "snapshot.create", rest_api: "snapshot.create") response.body end @@ -69,7 +69,7 @@ def create(body = {}, params = {}) def get(params = {}) # Set snapshot name or we'll get the repository instead snapshot = name || "_all" - response = client.get "/_snapshot/{repository}/{snapshot}", update_params(params, snapshot: snapshot, action: "snapshot.get", rest_api: "snapshot.get") + response = client.get "/_snapshot/{repository}/{snapshot}", update_params(params, snapshot:, action: "snapshot.get", rest_api: "snapshot.get") response.body end @@ -92,7 +92,7 @@ def status(params = {}) # # Returns the response body as a Hash def restore(body = {}, params = {}) - response = client.post "/_snapshot/{repository}/{snapshot}/_restore", update_params(params, body: body, action: "snapshot.restore", rest_api: "snapshot.restore") + response = client.post "/_snapshot/{repository}/{snapshot}/_restore", update_params(params, body:, action: "snapshot.restore", rest_api: "snapshot.restore") response.body end @@ -122,7 +122,7 @@ def update_params(params, overrides = nil) # Internal: Returns a Hash containing default parameters. def defaults - { repository: repository, snapshot: name } + { repository:, snapshot: name } end end end diff --git a/lib/elastomer_client/client/tasks.rb b/lib/elastomer_client/client/tasks.rb index a2fc28e9..17f64065 100644 --- a/lib/elastomer_client/client/tasks.rb +++ b/lib/elastomer_client/client/tasks.rb @@ -112,7 +112,7 @@ def get_by_parent_id(parent_node_id, parent_task_id, params = {}) # Returns the response body as a Hash when timeout expires or target tasks complete # COMPATIBILITY WARNING: the response body differs between ES versions for this API def wait_for(timeout = "10s", params = {}) - self.get params.merge(wait_for_completion: true, timeout: timeout) + self.get params.merge(wait_for_completion: true, timeout:)) end # Wait for the specified amount of time (10 seconds by default) for some task(s) to complete. @@ -133,7 +133,7 @@ def wait_by_id(node_id, task_id, timeout = "10s", params = {}) raise ArgumentError, "invalid node ID provided: #{node_id.inspect}" if node_id.to_s.empty? raise ArgumentError, "invalid task ID provided: #{task_id.inspect}" unless task_id.is_a?(Integer) - self.get_by_id(node_id, task_id, params.merge(wait_for_completion: true, timeout: timeout)) + self.get_by_id(node_id, task_id, params.merge(wait_for_completion: true, timeout:))) end # Cancels a task running on a particular node. diff --git a/lib/elastomer_client/notifications.rb b/lib/elastomer_client/notifications.rb index fc0d5c2c..d994a74e 100644 --- a/lib/elastomer_client/notifications.rb +++ b/lib/elastomer_client/notifications.rb @@ -63,7 +63,7 @@ def instrument(path, body, params) action: params[:action], context: params[:context], request_body: body, - body: body # for backwards compatibility + body: # for backwards compatibility } ::ElastomerClient::Notifications.service.instrument(NAME, payload) do diff --git a/test/client/errors_test.rb b/test/client/errors_test.rb index fb06ff50..bee243bb 100644 --- a/test/client/errors_test.rb +++ b/test/client/errors_test.rb @@ -39,7 +39,7 @@ }, "status" => 404 } - response = Faraday::Response.new(body: body) + response = Faraday::Response.new(body:)) err = ElastomerClient::Client::Error.new(response) assert_equal body["error"].to_s, err.message diff --git a/test/client/index_test.rb b/test/client/index_test.rb index ee384bcc..1edf9a4e 100644 --- a/test/client/index_test.rb +++ b/test/client/index_test.rb @@ -284,7 +284,7 @@ properties: { title: { type: "text", analyzer: "standard" }, author: { type: "keyword" }, - suggest: suggest + suggest: } }, true) ) diff --git a/test/client/native_delete_by_query_test.rb b/test/client/native_delete_by_query_test.rb index 81b4a21c..fbeebb2e 100644 --- a/test/client/native_delete_by_query_test.rb +++ b/test/client/native_delete_by_query_test.rb @@ -85,7 +85,7 @@ # default number of shards in ES8 is 1, so set it to 2 shards so routing to different shards can be tested settings = $client.version_support.es_version_8_plus? ? { number_of_shards: 2 } : {} index.create({ - settings: settings, + settings:, mappings: mappings_wrapper(type, { properties: { name: { type: "text", analyzer: "standard" }, diff --git a/test/client/rest_api_spec/api_spec_test.rb b/test/client/rest_api_spec/api_spec_test.rb index 42f1b806..0c8ecf63 100644 --- a/test/client/rest_api_spec/api_spec_test.rb +++ b/test/client/rest_api_spec/api_spec_test.rb @@ -51,7 +51,7 @@ it "validates request params" do params = {q: "*:*", pretty: true, "nope": false} assert_raises(ElastomerClient::Client::IllegalArgument, "'nope' is not a valid parameter for the 'search' API") { - @api_spec.validate_params!(api: "search", params: params) + @api_spec.validate_params!(api: "search", params:) } end end diff --git a/test/client/update_by_query_test.rb b/test/client/update_by_query_test.rb index 28e74f48..d6cc5bc1 100644 --- a/test/client/update_by_query_test.rb +++ b/test/client/update_by_query_test.rb @@ -88,7 +88,7 @@ # default number of shards in ES8 is 1, so set it to 2 shards so routing to different shards can be tested settings = $client.version_support.es_version_8_plus? ? { number_of_shards: 2 } : {} index.create({ - settings: settings, + settings:, mappings: mappings_wrapper(type, { properties: { name: { type: "text", analyzer: "standard" }, diff --git a/test/middleware/encode_json_test.rb b/test/middleware/encode_json_test.rb index 7afaaa12..006cb95e 100644 --- a/test/middleware/encode_json_test.rb +++ b/test/middleware/encode_json_test.rb @@ -6,7 +6,7 @@ let(:middleware) { ElastomerClient::Middleware::EncodeJson.new(lambda { |env| env }) } def process(body, content_type: nil, method: :post) - env = { body: body, request_headers: Faraday::Utils::Headers.new, method: method } + env = { body:, request_headers: Faraday::Utils::Headers.new, method: } env[:request_headers]["content-type"] = content_type if content_type middleware.call(env) end diff --git a/test/middleware/parse_json_test.rb b/test/middleware/parse_json_test.rb index ce59642a..3acbf413 100644 --- a/test/middleware/parse_json_test.rb +++ b/test/middleware/parse_json_test.rb @@ -7,7 +7,7 @@ let(:headers) { Hash.new } def process(body, content_type = nil) - env = { body: body, response_headers: Faraday::Utils::Headers.new(headers) } + env = { body:, response_headers: Faraday::Utils::Headers.new(headers) } env[:response_headers]["content-type"] = content_type if content_type middleware.call(env) end diff --git a/test/test_helper.rb b/test/test_helper.rb index e031a003..604ea16a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -115,7 +115,7 @@ def run_snapshot_tests? def create_repo(name, settings = {}) location = File.join(*[ENV["SNAPSHOT_DIR"], name].compact) - default_settings = {type: "fs", settings: {location: location}} + default_settings = {type: "fs", settings: {location:}} $client.repository(name).create(default_settings.merge(settings)) end From 5731444c5a6a616ee57f4ce1f4286917ad7d42cb Mon Sep 17 00:00:00 2001 From: Neil Donewar Date: Tue, 5 Dec 2023 18:20:40 +0000 Subject: [PATCH 3/4] Manually fix extra trailing parens --- lib/elastomer_client/client/tasks.rb | 4 ++-- test/client/errors_test.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/elastomer_client/client/tasks.rb b/lib/elastomer_client/client/tasks.rb index 17f64065..a128980d 100644 --- a/lib/elastomer_client/client/tasks.rb +++ b/lib/elastomer_client/client/tasks.rb @@ -112,7 +112,7 @@ def get_by_parent_id(parent_node_id, parent_task_id, params = {}) # Returns the response body as a Hash when timeout expires or target tasks complete # COMPATIBILITY WARNING: the response body differs between ES versions for this API def wait_for(timeout = "10s", params = {}) - self.get params.merge(wait_for_completion: true, timeout:)) + self.get params.merge(wait_for_completion: true, timeout:) end # Wait for the specified amount of time (10 seconds by default) for some task(s) to complete. @@ -133,7 +133,7 @@ def wait_by_id(node_id, task_id, timeout = "10s", params = {}) raise ArgumentError, "invalid node ID provided: #{node_id.inspect}" if node_id.to_s.empty? raise ArgumentError, "invalid task ID provided: #{task_id.inspect}" unless task_id.is_a?(Integer) - self.get_by_id(node_id, task_id, params.merge(wait_for_completion: true, timeout:))) + self.get_by_id(node_id, task_id, params.merge(wait_for_completion: true, timeout:)) end # Cancels a task running on a particular node. diff --git a/test/client/errors_test.rb b/test/client/errors_test.rb index bee243bb..224dc33f 100644 --- a/test/client/errors_test.rb +++ b/test/client/errors_test.rb @@ -39,7 +39,7 @@ }, "status" => 404 } - response = Faraday::Response.new(body:)) + response = Faraday::Response.new(body:) err = ElastomerClient::Client::Error.new(response) assert_equal body["error"].to_s, err.message From 59ef81fea76dbb662abf7d93755b5af5f4aab630 Mon Sep 17 00:00:00 2001 From: Neil Donewar Date: Tue, 5 Dec 2023 19:12:47 +0000 Subject: [PATCH 4/4] Simplify CI and RuboCop to Ruby 3.2 only --- .github/workflows/main.yml | 2 +- .github/workflows/rubocop.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61df8a90..f4eb6031 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2'] + ruby-version: ['3.2'] ES_VERSION: ['5.6.15', '8.7.0'] include: - ES_VERSION: '5.6.15' diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index c3274705..49e8f7ee 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -10,6 +10,6 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: '3.1' + ruby-version: '3.2' bundler-cache: true - run: bundle exec rubocop