elasticsearch-api 8.5.0 → 8.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a93e7def7192582d7c79489a2ad2953b23d41fa75c49f81e93ad717d951e6d2a
4
- data.tar.gz: 8ecf595ae67b718028e6da5792b708a1439dc5e0522dab7d4da3f4b251541d83
3
+ metadata.gz: 9bd26909280a3cbc03ad35a729262ee7c0cf4e274ace5ccc754c334bbb667a9b
4
+ data.tar.gz: 5bb02f69dafac974d267266fe6025c0ab83ace5953902a54f2f2e4497cb12b2c
5
5
  SHA512:
6
- metadata.gz: b6bb3945019969e536124a24ecee54e3eea42b1a6b7bfd24e3d49fb9f8fa8b58753224361e24560802eef8713fefb565553d9959e171898d8c9f737eb3b0941f
7
- data.tar.gz: 361a85f3cba1eaa248947475a53531070916567669365306feaaee88274c8c52d49c21f36b91a28447837a6dfd1a20c1bad55af08e493533ff07baa02cd17269
6
+ metadata.gz: c2e7567c87875abd3d703c240eece417186d177525efdece09cf7ed870d53c7f3e84e2a4faebc116d0f2176ce91cf3be43c1c3a7790f607b7fcd56e5f8fe3400
7
+ data.tar.gz: 203af27e5d281b2a72330c17179187b874a87a364484757ed6128aae5b3a80a5b18be06841f0bc3631ab4e17399b39b255b4d2b40989b380c2df231072d40f8a
@@ -42,6 +42,14 @@ end
42
42
  # Validate that a field is `true`.
43
43
  RSpec::Matchers.define :match_true_field do |field, test|
44
44
  match do |response|
45
+ # TODO: Refactor! split_key for is_true
46
+ if (match = field.match(/(^\$[a-z]+)/))
47
+ keys = field.split('.')
48
+ keys.delete(match[1])
49
+ dynamic_key = test.cached_values[match[1].gsub('$', '')]
50
+ return !!dynamic_key.dig(*keys)
51
+ end
52
+
45
53
  # Handle is_true: ''
46
54
  return !!response if field == ''
47
55
 
@@ -190,10 +198,24 @@ RSpec::Matchers.define :match_response do |pairs, test|
190
198
 
191
199
  def compare_hash(expected_pairs, actual_hash, test)
192
200
  expected_pairs.each do |expected_key, expected_value|
193
- # Find the value to compare in the response
194
- split_key = TestFile::Test.split_and_parse_key(expected_key).collect do |k|
195
- # Sometimes the expected *key* is a cached value from a previous request.
196
- test.get_cached_value(k)
201
+ # TODO: Refactor! split_key
202
+ if (match = expected_key.match(/(^\$[a-z]+)/))
203
+ keys = expected_key.split('.')
204
+ keys.delete(match[1])
205
+ dynamic_key = test.cached_values[match[1].gsub('$', '')]
206
+ value = dynamic_key.dig(*keys)
207
+
208
+ if expected_pairs.values.first.is_a?(String) && expected_pairs.values.first.match?(/^\$/)
209
+ return test.cached_values[expected_pairs.values.first.gsub('$','')] == value
210
+ else
211
+ return expected_pairs.values.first == value
212
+ end
213
+
214
+ else
215
+ split_key = TestFile::Test.split_and_parse_key(expected_key).collect do |k|
216
+ # Sometimes the expected *key* is a cached value from a previous request.
217
+ test.get_cached_value(k)
218
+ end
197
219
  end
198
220
  # We now accept 'nested.keys' so let's try the previous implementation and if that doesn't
199
221
  # work, try with the nested key, otherwise, raise exception.
@@ -122,6 +122,12 @@ module Elasticsearch
122
122
  @response = client.send(_method, prepare_arguments(args, test))
123
123
  end
124
124
  client
125
+ when 'update_user_profile_data', 'get_user_profile', 'enable_user_profile', 'disable_user_profile'
126
+ args.each do |key, value|
127
+ args[key] = value.gsub(value, test.cached_values[value.gsub('$', '')]) if value.match?(/^\$/)
128
+ end
129
+ @response = client.send(_method, prepare_arguments(args, test))
130
+ client
125
131
  else
126
132
  @response = client.send(_method, prepare_arguments(args, test))
127
133
  client
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module API
20
- VERSION = '8.5.0'.freeze
20
+ VERSION = '8.5.1'.freeze
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.5.0
4
+ version: 8.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-01 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json