google-cloud-firestore 2.0.0 → 2.4.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: e83411cc86b2d8999f2ea7771cc243f032b9119c03885427aa57b007c3695406
4
- data.tar.gz: 2ba1894414f95466c521ac6159dcfeedfb713727049171226a0eaecb2b041a71
3
+ metadata.gz: 3947e279213a82502325fd1f9245f72c9b5d3fa837907608f6bdd62bff31e69f
4
+ data.tar.gz: 849fc8dc2f763b24334d4accdc2ee4196059c429d273f3f661bf50d81a6d9774
5
5
  SHA512:
6
- metadata.gz: ee5186f01ad3ec6adf7508a043793306c622f77b5a4552f91a787d52860e57e8e65c99561d8995cd7dd3a424801ac7e56b36174e6a9139179bed3ac708391966
7
- data.tar.gz: 0c2037885a4d5b12151f346f181de0f632e6c2c399e095899cd9567ad484ac954463c757740c0306639473edf69115a1e8fc37e1914727cbef11d90241aaef9c
6
+ metadata.gz: 8d2a6c39cc4b321a2561b5ae50928eaec7a3acfafe5fec62a7383d5c3dc77c60ba96f81c2c027bcfe46be6f8ab02c0f76f93afd0dd5ab5bb7fdea9e141a33fe4
7
+ data.tar.gz: 70b462d91bd613ee0a5c333653dc096c28878d4bf28eacc6282c4edf57123985eeec8eee4d98af24aba334ea824e2e37d2add104aa8e32c26c7668c7dc62df4f
@@ -1,5 +1,43 @@
1
1
  # Release History
2
2
 
3
+ ### 2.4.1 / 2021-01-06
4
+
5
+ #### Bug Fixes
6
+
7
+ * Replace usage of Write.transform with Write.update_transforms
8
+
9
+ ### 2.4.0 / 2020-11-19
10
+
11
+ #### Features
12
+
13
+ * add support for != and NOT_IN queries
14
+
15
+ ### 2.3.0 / 2020-09-30
16
+
17
+ #### Features
18
+
19
+ * Add error callbacks for listener threads
20
+ * Add DocumentListener#last_error
21
+ * Add DocumentListener#on_error
22
+ * Add QueryListener#last_error
23
+ * Add QueryListener#on_error
24
+
25
+ ### 2.2.0 / 2020-09-17
26
+
27
+ #### Features
28
+
29
+ * quota_project can be set via library configuration ([#7630](https://www.github.com/googleapis/google-cloud-ruby/issues/7630))
30
+
31
+ #### Documentation
32
+
33
+ * Add snapshot query cursor sample ([#7601](https://www.github.com/googleapis/google-cloud-ruby/issues/7601))
34
+
35
+ ### 2.1.0 / 2020-09-10
36
+
37
+ #### Features
38
+
39
+ * Add Query#limit_to_last
40
+
3
41
  ### 2.0.0 / 2020-08-06
4
42
 
5
43
  This is a major update that removes the "low-level" client interface code, and
@@ -45,7 +45,7 @@ there is a small amount of setup:
45
45
 
46
46
  ```sh
47
47
  $ cd google-cloud-firestore/
48
- $ bundle exec rake bundleupdate
48
+ $ bundle install
49
49
  ```
50
50
 
51
51
  ## Console
@@ -125,6 +125,7 @@ Google::Cloud.configure.add_config! :firestore do |config|
125
125
  config.add_field! :credentials, default_creds, match: [String, Hash, Google::Auth::Credentials], allow_nil: true
126
126
  config.add_alias! :keyfile, :credentials
127
127
  config.add_field! :scope, default_scopes, match: [String, Array]
128
+ config.add_field! :quota_project, nil, match: String
128
129
  config.add_field! :timeout, nil, match: Integer
129
130
  config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
130
131
  config.add_field! :endpoint, "firestore.googleapis.com", match: String
@@ -119,7 +119,7 @@ module Google
119
119
 
120
120
  doc_path = coalesce_doc_path_argument doc
121
121
 
122
- @writes << Convert.writes_for_create(doc_path, data)
122
+ @writes << Convert.write_for_create(doc_path, data)
123
123
 
124
124
  nil
125
125
  end
@@ -218,7 +218,7 @@ module Google
218
218
 
219
219
  doc_path = coalesce_doc_path_argument doc
220
220
 
221
- @writes << Convert.writes_for_set(doc_path, data, merge: merge)
221
+ @writes << Convert.write_for_set(doc_path, data, merge: merge)
222
222
 
223
223
  nil
224
224
  end
@@ -322,8 +322,8 @@ module Google
322
322
 
323
323
  doc_path = coalesce_doc_path_argument doc
324
324
 
325
- @writes << Convert.writes_for_update(doc_path, data,
326
- update_time: update_time)
325
+ @writes << Convert.write_for_update(doc_path, data,
326
+ update_time: update_time)
327
327
 
328
328
  nil
329
329
  end
@@ -24,7 +24,13 @@ module Google
24
24
  ##
25
25
  # @private Helper module for converting Protobuf values.
26
26
  module Convert
27
- # rubocop:disable all
27
+ # rubocop:disable Metrics/AbcSize
28
+ # rubocop:disable Metrics/BlockLength
29
+ # rubocop:disable Metrics/CyclomaticComplexity
30
+ # rubocop:disable Metrics/MethodLength
31
+ # rubocop:disable Metrics/ModuleLength
32
+ # rubocop:disable Metrics/PerceivedComplexity
33
+ # rubocop:disable Style/CaseEquality
28
34
  module ClassMethods
29
35
  def time_to_timestamp time
30
36
  return nil if time.nil?
@@ -32,9 +38,10 @@ module Google
32
38
  # Force the object to be a Time object.
33
39
  time = time.to_time
34
40
 
35
- Google::Protobuf::Timestamp.new \
41
+ Google::Protobuf::Timestamp.new(
36
42
  seconds: time.to_i,
37
- nanos: time.nsec
43
+ nanos: time.nsec
44
+ )
38
45
  end
39
46
 
40
47
  def timestamp_to_time timestamp
@@ -100,9 +107,10 @@ module Google
100
107
  elsif Google::Cloud::Firestore::DocumentReference === obj
101
108
  Google::Cloud::Firestore::V1::Value.new reference_value: obj.path
102
109
  elsif Array === obj
103
- values = obj.map { |o| raw_to_value(o) }
104
- Google::Cloud::Firestore::V1::Value.new(array_value:
105
- Google::Cloud::Firestore::V1::ArrayValue.new(values: values))
110
+ values = obj.map { |o| raw_to_value o }
111
+ Google::Cloud::Firestore::V1::Value.new(
112
+ array_value: Google::Cloud::Firestore::V1::ArrayValue.new(values: values)
113
+ )
106
114
  elsif Hash === obj
107
115
  # keys have been changed to strings before the hash gets here
108
116
  geo_pairs = hash_is_geo_point? obj
@@ -112,8 +120,9 @@ module Google
112
120
  )
113
121
  else
114
122
  fields = hash_to_fields obj
115
- Google::Cloud::Firestore::V1::Value.new(map_value:
116
- Google::Cloud::Firestore::V1::MapValue.new(fields: fields))
123
+ Google::Cloud::Firestore::V1::Value.new(
124
+ map_value: Google::Cloud::Firestore::V1::MapValue.new(fields: fields)
125
+ )
117
126
  end
118
127
  elsif obj.respond_to?(:read) && obj.respond_to?(:rewind)
119
128
  obj.rewind
@@ -129,9 +138,7 @@ module Google
129
138
  return false unless hash.keys.count == 2
130
139
 
131
140
  pairs = hash.map { |k, v| [String(k), v] }.sort
132
- if pairs.map(&:first) == ["latitude", "longitude"]
133
- pairs
134
- end
141
+ pairs if pairs.map(&:first) == ["latitude", "longitude"]
135
142
  end
136
143
 
137
144
  def hash_to_geo_point hash, pairs = nil
@@ -140,47 +147,39 @@ module Google
140
147
  raise ArgumentError, "value is not a geo point" unless pairs
141
148
 
142
149
  Google::Type::LatLng.new(
143
- latitude: pairs.first.last,
144
- longitude: pairs.last.last,
150
+ latitude: pairs.first.last,
151
+ longitude: pairs.last.last
145
152
  )
146
153
  end
147
154
 
148
- def writes_for_create doc_path, data
149
- writes = []
150
-
151
- if is_field_value_nested data, :delete
155
+ def write_for_create doc_path, data
156
+ if field_value_nested? data, :delete
152
157
  raise ArgumentError, "DELETE not allowed on create"
153
158
  end
154
159
  raise ArgumentError, "data is required" unless data.is_a? Hash
155
160
 
156
161
  data, field_paths_and_values = remove_field_value_from data
157
162
 
158
- if data.any? || field_paths_and_values.empty?
159
- write = Google::Cloud::Firestore::V1::Write.new(
160
- update: Google::Cloud::Firestore::V1::Document.new(
161
- name: doc_path,
162
- fields: hash_to_fields(data)),
163
- current_document: Google::Cloud::Firestore::V1::Precondition.new(
164
- exists: false)
165
- )
166
- writes << write
167
- end
168
-
169
- if field_paths_and_values.any?
170
- transform_write = transform_write doc_path, field_paths_and_values
171
-
172
- if data.empty?
173
- transform_write.current_document = \
174
- Google::Cloud::Firestore::V1::Precondition.new(exists: false)
175
- end
176
-
177
- writes << transform_write
178
- end
163
+ doc = Google::Cloud::Firestore::V1::Document.new(
164
+ name: doc_path,
165
+ fields: hash_to_fields(data)
166
+ )
167
+ precondition = Google::Cloud::Firestore::V1::Precondition.new exists: false
168
+ Google::Cloud::Firestore::V1::Write.new(
169
+ update: doc,
170
+ current_document: precondition,
171
+ update_transforms: field_transforms(field_paths_and_values)
172
+ )
173
+ end
179
174
 
180
- writes
175
+ def field_transforms paths
176
+ return nil if paths.empty?
177
+ paths.map do |field_path, field_value|
178
+ to_field_transform field_path, field_value
179
+ end.to_a
181
180
  end
182
181
 
183
- def writes_for_set doc_path, data, merge: nil
182
+ def write_for_set doc_path, data, merge: nil
184
183
  raise ArgumentError, "data is required" unless data.is_a? Hash
185
184
 
186
185
  if merge
@@ -195,11 +194,9 @@ module Google
195
194
  end
196
195
  allow_empty = false
197
196
  end
198
- return writes_for_set_merge doc_path, data, field_paths, allow_empty
197
+ return write_for_set_merge doc_path, data, field_paths, allow_empty
199
198
  end
200
199
 
201
- writes = []
202
-
203
200
  data, delete_paths = remove_field_value_from data, :delete
204
201
  if delete_paths.any?
205
202
  raise ArgumentError, "DELETE not allowed on set"
@@ -207,30 +204,25 @@ module Google
207
204
 
208
205
  data, field_paths_and_values = remove_field_value_from data
209
206
 
210
- writes << Google::Cloud::Firestore::V1::Write.new(
211
- update: Google::Cloud::Firestore::V1::Document.new(
212
- name: doc_path,
213
- fields: hash_to_fields(data))
207
+ doc = Google::Cloud::Firestore::V1::Document.new(
208
+ name: doc_path,
209
+ fields: hash_to_fields(data)
210
+ )
211
+ Google::Cloud::Firestore::V1::Write.new(
212
+ update: doc,
213
+ update_transforms: field_transforms(field_paths_and_values)
214
214
  )
215
-
216
- if field_paths_and_values.any?
217
- writes << transform_write(doc_path, field_paths_and_values)
218
- end
219
-
220
- writes
221
215
  end
222
216
 
223
- def writes_for_set_merge doc_path, data, field_paths, allow_empty
217
+ def write_for_set_merge doc_path, data, field_paths, allow_empty
224
218
  raise ArgumentError, "data is required" unless data.is_a? Hash
225
219
 
226
220
  validate_field_paths! field_paths
227
221
 
228
- writes = []
229
-
230
222
  # Ensure provided field paths are valid.
231
223
  all_valid = identify_leaf_nodes data
232
224
  all_valid_check = field_paths.map do |verify_path|
233
- if all_valid.include?(verify_path)
225
+ if all_valid.include? verify_path
234
226
  true
235
227
  else
236
228
  found_in_all_valid = all_valid.select do |fp|
@@ -277,26 +269,21 @@ module Google
277
269
  end
278
270
  end
279
271
 
280
- if data.any? || field_paths.any? || (allow_empty && field_paths_and_values.empty?)
281
- writes << Google::Cloud::Firestore::V1::Write.new(
282
- update: Google::Cloud::Firestore::V1::Document.new(
283
- name: doc_path,
284
- fields: hash_to_fields(data)),
285
- update_mask: Google::Cloud::Firestore::V1::DocumentMask.new(
286
- field_paths: field_paths.map(&:formatted_string).sort)
287
- )
288
- end
289
-
290
- if field_paths_and_values.any?
291
- writes << transform_write(doc_path, field_paths_and_values)
292
- end
293
-
294
- writes
272
+ doc = Google::Cloud::Firestore::V1::Document.new(
273
+ name: doc_path,
274
+ fields: hash_to_fields(data)
275
+ )
276
+ doc_mask = Google::Cloud::Firestore::V1::DocumentMask.new(
277
+ field_paths: field_paths.map(&:formatted_string).sort
278
+ )
279
+ Google::Cloud::Firestore::V1::Write.new(
280
+ update: doc,
281
+ update_mask: doc_mask,
282
+ update_transforms: field_transforms(field_paths_and_values)
283
+ )
295
284
  end
296
285
 
297
- def writes_for_update doc_path, data, update_time: nil
298
- writes = []
299
-
286
+ def write_for_update doc_path, data, update_time: nil
300
287
  raise ArgumentError, "data is required" unless data.is_a? Hash
301
288
 
302
289
  # Convert data to use FieldPath
@@ -308,11 +295,11 @@ module Google
308
295
  # Duplicate field paths check
309
296
  validate_field_paths! new_data_pairs.map(&:first)
310
297
 
311
- delete_paths, new_data_pairs = new_data_pairs.partition do |field_path, value|
298
+ delete_paths, new_data_pairs = new_data_pairs.partition do |_field_path, value|
312
299
  value.is_a?(FieldValue) && value.type == :delete
313
300
  end
314
301
 
315
- root_field_paths_and_values, new_data_pairs = new_data_pairs.partition do |field_path, value|
302
+ root_field_paths_and_values, new_data_pairs = new_data_pairs.partition do |_field_path, value|
316
303
  value.is_a? FieldValue
317
304
  end
318
305
 
@@ -325,7 +312,7 @@ module Google
325
312
  data, nested_deletes = remove_field_value_from data, :delete
326
313
  raise ArgumentError, "DELETE cannot be nested" if nested_deletes.any?
327
314
 
328
- data, nested_field_paths_and_values = remove_field_value_from data
315
+ data, nested_field_paths_and_values = remove_field_value_from data
329
316
 
330
317
  field_paths_and_values = root_field_paths_and_values.merge nested_field_paths_and_values
331
318
 
@@ -338,34 +325,31 @@ module Google
338
325
  raise ArgumentError, "data is required"
339
326
  end
340
327
 
328
+ write = Google::Cloud::Firestore::V1::Write.new(
329
+ update: Google::Cloud::Firestore::V1::Document.new(name: doc_path),
330
+ update_mask: Google::Cloud::Firestore::V1::DocumentMask.new,
331
+ current_document: Google::Cloud::Firestore::V1::Precondition.new(exists: true)
332
+ )
333
+
341
334
  if data.any? || delete_paths.any?
342
- write = Google::Cloud::Firestore::V1::Write.new(
343
- update: Google::Cloud::Firestore::V1::Document.new(
344
- name: doc_path,
345
- fields: hash_to_fields(data)),
346
- update_mask: Google::Cloud::Firestore::V1::DocumentMask.new(
347
- field_paths: (field_paths).map(&:formatted_string).sort),
348
- current_document: Google::Cloud::Firestore::V1::Precondition.new(
349
- exists: true)
350
- )
335
+ htf = hash_to_fields data
336
+ htf.each_pair do |k, v|
337
+ write.update.fields[k] = v
338
+ end
339
+ write.update_mask.field_paths += field_paths.map(&:formatted_string).sort
340
+
351
341
  if update_time
352
- write.current_document = \
353
- Google::Cloud::Firestore::V1::Precondition.new(
354
- update_time: time_to_timestamp(update_time))
342
+ write.current_document = Google::Cloud::Firestore::V1::Precondition.new(
343
+ update_time: time_to_timestamp(update_time)
344
+ )
355
345
  end
356
- writes << write
357
346
  end
358
347
 
359
348
  if field_paths_and_values.any?
360
- transform_write = transform_write doc_path, field_paths_and_values
361
- if data.empty?
362
- transform_write.current_document = \
363
- Google::Cloud::Firestore::V1::Precondition.new(exists: true)
364
- end
365
- writes << transform_write
349
+ write.update_transforms += field_transforms field_paths_and_values
366
350
  end
367
351
 
368
- writes
352
+ write
369
353
  end
370
354
 
371
355
  def write_for_delete doc_path, exists: nil, update_time: nil
@@ -387,13 +371,19 @@ module Google
387
371
  write
388
372
  end
389
373
 
390
- def is_field_value_nested obj, field_value_type = nil
374
+ def field_value_nested? obj, field_value_type = nil
391
375
  return obj if obj.is_a?(FieldValue) && (field_value_type.nil? || obj.type == field_value_type)
392
376
 
393
377
  if obj.is_a? Array
394
- obj.each { |o| val = is_field_value_nested o, field_value_type; return val if val }
378
+ obj.each do |o|
379
+ val = field_value_nested? o, field_value_type
380
+ return val if val
381
+ end
395
382
  elsif obj.is_a? Hash
396
- obj.each { |_k, v| val = is_field_value_nested v, field_value_type; return val if val }
383
+ obj.each do |_k, v|
384
+ val = field_value_nested? v, field_value_type
385
+ return val if val
386
+ end
397
387
  end
398
388
  nil
399
389
  end
@@ -406,35 +396,33 @@ module Google
406
396
  if value.is_a?(FieldValue) && (field_value_type.nil? || value.type == field_value_type)
407
397
  paths << [FieldPath.new(*key), value]
408
398
  nil # will be removed by calling compact
409
- else
410
- if value.is_a? Hash
411
- unless value.empty?
412
- nested_hash, nested_paths = remove_field_value_from value, field_value_type
413
- if nested_paths.any?
414
- nested_paths.each do |nested_field_path, nested_field_value|
415
- updated_field_paths = ([key] + nested_field_path.fields).flatten
416
- updated_field_path = FieldPath.new *updated_field_paths
417
- paths << [updated_field_path, nested_field_value]
418
- end
419
- end
420
- if nested_hash.empty?
421
- nil # will be removed by calling compact
422
- else
423
- [String(key), nested_hash]
399
+ elsif value.is_a? Hash
400
+ if value.empty?
401
+ [String(key), value]
402
+ else
403
+ nested_hash, nested_paths = remove_field_value_from value, field_value_type
404
+ if nested_paths.any?
405
+ nested_paths.each do |nested_field_path, nested_field_value|
406
+ updated_field_paths = ([key] + nested_field_path.fields).flatten
407
+ updated_field_path = FieldPath.new(*updated_field_paths)
408
+ paths << [updated_field_path, nested_field_value]
424
409
  end
410
+ end
411
+ if nested_hash.empty?
412
+ nil # will be removed by calling compact
425
413
  else
426
- [String(key), value]
414
+ [String(key), nested_hash]
427
415
  end
428
- else
429
- if value.is_a? Array
430
- nested_field_value = is_field_value_nested value, field_value_type
431
- if nested_field_value
432
- raise ArgumentError, "cannot nest #{nested_field_value.type} under arrays"
433
- end
416
+ end
417
+ else
418
+ if value.is_a? Array
419
+ nested_field_value = field_value_nested? value, field_value_type
420
+ if nested_field_value
421
+ raise ArgumentError, "cannot nest #{nested_field_value.type} under arrays"
434
422
  end
435
-
436
- [String(key), value]
437
423
  end
424
+
425
+ [String(key), value]
438
426
  end
439
427
  end
440
428
 
@@ -449,14 +437,14 @@ module Google
449
437
  if value.is_a? Hash
450
438
  nested_paths = identify_leaf_nodes value
451
439
  nested_paths.each do |nested_path|
452
- paths << (([key] + nested_path.fields).flatten)
440
+ paths << ([key] + nested_path.fields).flatten
453
441
  end
454
442
  else
455
443
  paths << [key]
456
444
  end
457
445
  end
458
446
 
459
- paths.map { |path| FieldPath.new *path }
447
+ paths.map { |path| FieldPath.new(*path) }
460
448
  end
461
449
 
462
450
  def identify_all_file_paths hash
@@ -465,15 +453,14 @@ module Google
465
453
  hash.map do |key, value|
466
454
  paths << [key]
467
455
 
468
- if value.is_a? Hash
469
- nested_paths = identify_all_file_paths value
470
- nested_paths.each do |nested_path|
471
- paths << (([key] + nested_path.fields).flatten)
472
- end
456
+ next unless value.is_a? Hash
457
+ nested_paths = identify_all_file_paths value
458
+ nested_paths.each do |nested_path|
459
+ paths << ([key] + nested_path.fields).flatten
473
460
  end
474
461
  end
475
462
 
476
- paths.map { |path| FieldPath.new *path }
463
+ paths.map { |path| FieldPath.new(*path) }
477
464
  end
478
465
 
479
466
  def select_by_field_paths hash, field_paths
@@ -533,19 +520,19 @@ module Google
533
520
  right_hash.each_pair do |key, right_value|
534
521
  left_value = left_hash[key]
535
522
 
536
- if left_value.is_a?(Hash) && right_value.is_a?(Hash)
537
- left_hash[key] = deep_merge_hashes left_value, right_value
538
- else
539
- left_hash[key] = right_value
540
- end
523
+ left_hash[key] = if left_value.is_a?(Hash) && right_value.is_a?(Hash)
524
+ deep_merge_hashes left_value, right_value
525
+ else
526
+ right_value
527
+ end
541
528
  end
542
529
 
543
530
  left_hash
544
531
  end
545
532
 
546
- START_FIELD_PATH_CHARS = /\A[a-zA-Z_]/
547
- INVALID_FIELD_PATH_CHARS = /[\~\*\/\[\]]/
548
- ESCAPED_FIELD_PATH = /\A\`(.*)\`\z/
533
+ START_FIELD_PATH_CHARS = /\A[a-zA-Z_]/.freeze
534
+ INVALID_FIELD_PATH_CHARS = %r{[\~\*/\[\]]}.freeze
535
+ ESCAPED_FIELD_PATH = /\A\`(.*)\`\z/.freeze
549
536
 
550
537
  def build_hash_from_field_paths_and_values pairs
551
538
  pairs.each do |field_path, _value|
@@ -579,59 +566,52 @@ module Google
579
566
  "`#{str}`"
580
567
  end
581
568
 
582
- def transform_write doc_path, paths
583
- field_transforms = paths.map do |field_path, field_value|
584
- to_field_transform field_path, field_value
585
- end
586
-
587
- Google::Cloud::Firestore::V1::Write.new(
588
- transform: Google::Cloud::Firestore::V1::DocumentTransform.new(
589
- document: doc_path,
590
- field_transforms: field_transforms
591
- )
592
- )
593
- end
594
-
595
569
  def to_field_transform field_path, field_value
596
570
  if field_value.type == :server_time
597
571
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
598
- field_path: field_path.formatted_string,
572
+ field_path: field_path.formatted_string,
599
573
  set_to_server_value: :REQUEST_TIME
600
574
  )
601
575
  elsif field_value.type == :array_union
602
576
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
603
- field_path: field_path.formatted_string,
577
+ field_path: field_path.formatted_string,
604
578
  append_missing_elements: raw_to_value(Array(field_value.value)).array_value
605
579
  )
606
580
  elsif field_value.type == :array_delete
607
581
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
608
- field_path: field_path.formatted_string,
582
+ field_path: field_path.formatted_string,
609
583
  remove_all_from_array: raw_to_value(Array(field_value.value)).array_value
610
584
  )
611
585
  elsif field_value.type == :increment
612
586
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
613
587
  field_path: field_path.formatted_string,
614
- increment: raw_to_value(field_value.value)
588
+ increment: raw_to_value(field_value.value)
615
589
  )
616
590
  elsif field_value.type == :maximum
617
591
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
618
592
  field_path: field_path.formatted_string,
619
- maximum: raw_to_value(field_value.value)
593
+ maximum: raw_to_value(field_value.value)
620
594
  )
621
595
  elsif field_value.type == :minimum
622
596
  Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform.new(
623
597
  field_path: field_path.formatted_string,
624
- minimum: raw_to_value(field_value.value)
598
+ minimum: raw_to_value(field_value.value)
625
599
  )
626
600
  else
627
601
  raise ArgumentError, "unknown field transform #{field_value.type}"
628
602
  end
629
603
  end
630
604
  end
631
- # rubocop:enable all
632
605
 
633
606
  extend ClassMethods
634
607
  end
608
+ # rubocop:enable Metrics/AbcSize
609
+ # rubocop:enable Metrics/BlockLength
610
+ # rubocop:enable Metrics/CyclomaticComplexity
611
+ # rubocop:enable Metrics/MethodLength
612
+ # rubocop:enable Metrics/ModuleLength
613
+ # rubocop:enable Metrics/PerceivedComplexity
614
+ # rubocop:enable Style/CaseEquality
635
615
  end
636
616
  end
637
617
  end