google-cloud-firestore 0.21.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/google/cloud/firestore.rb +3 -7
- data/lib/google/cloud/firestore/batch.rb +2 -4
- data/lib/google/cloud/firestore/client.rb +9 -5
- data/lib/google/cloud/firestore/collection_reference.rb +5 -5
- data/lib/google/cloud/firestore/document_reference.rb +2 -4
- data/lib/google/cloud/firestore/field_path.rb +4 -0
- data/lib/google/cloud/firestore/query.rb +14 -10
- data/lib/google/cloud/firestore/transaction.rb +12 -14
- data/lib/google/cloud/firestore/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a0e9fff59882f2965b8f56086b8627ec80d55275535bd889aa5a87c7c0877ff
|
4
|
+
data.tar.gz: d9e8f986e2fd220cd68179e6c2cd1e3c3795dcd2f45ba6a8c050d255f01bd99f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478dc298a9f6fd09b99c297e84c30e615ab7fe1e9ac6b5fa1b9f6eeb5c427719f96714cb3fc0ecb53bfe230c15b80a6b11a885692028bfdff3ed56b4acec49c9
|
7
|
+
data.tar.gz: 002bd881ad0a3bbe61ed09e69b3395577a63c1e1a8af8584256dc974d609108b047a8de3f2bd08dcd3dba263be48ae9cb31f30f1294d13cb0cf050cbd1970f62
|
data/README.md
CHANGED
@@ -18,6 +18,17 @@ steps:
|
|
18
18
|
$ gem install google-cloud-firestore
|
19
19
|
```
|
20
20
|
|
21
|
+
### Supported Ruby Versions
|
22
|
+
|
23
|
+
This library is supported on Ruby 2.0+.
|
24
|
+
|
25
|
+
However, Ruby 2.3 or later is strongly recommended, as earlier releases have
|
26
|
+
reached or are nearing end-of-life. After June 1, 2018, Google will provide
|
27
|
+
official support only for Ruby versions that are considered current and
|
28
|
+
supported by Ruby Core (that is, Ruby versions that are either in normal
|
29
|
+
maintenance or in security maintenance).
|
30
|
+
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
|
31
|
+
|
21
32
|
### Next Steps
|
22
33
|
- Read the [Client Library Documentation][] for Google Cloud Firestore API
|
23
34
|
to see other available methods on the client.
|
@@ -212,9 +212,7 @@ module Google
|
|
212
212
|
#
|
213
213
|
# user_snap = firestore.doc("users/frank").get
|
214
214
|
#
|
215
|
-
# nested_field_path =
|
216
|
-
# :favorites, :food
|
217
|
-
# )
|
215
|
+
# nested_field_path = firestore.field_path :favorites, :food
|
218
216
|
# user_snap.get(nested_field_path) #=> "Pizza"
|
219
217
|
# ```
|
220
218
|
#
|
@@ -355,10 +353,8 @@ module Google
|
|
355
353
|
#
|
356
354
|
# user_ref = firestore.doc "users/frank"
|
357
355
|
#
|
358
|
-
# nested_field_path =
|
359
|
-
#
|
360
|
-
# )
|
361
|
-
# user_ref.update({ nested_field_path: "Pasta" })
|
356
|
+
# nested_field_path = firestore.field_path :favorites, :food
|
357
|
+
# user_ref.update({ nested_field_path => "Pasta" })
|
362
358
|
# ```
|
363
359
|
#
|
364
360
|
# ## Using transactions and batched writes
|
@@ -257,12 +257,10 @@ module Google
|
|
257
257
|
#
|
258
258
|
# firestore = Google::Cloud::Firestore.new
|
259
259
|
#
|
260
|
-
# nested_field_path =
|
261
|
-
# :favorites, :food
|
262
|
-
# )
|
260
|
+
# nested_field_path = firestore.field_path :favorites, :food
|
263
261
|
#
|
264
262
|
# firestore.batch do |b|
|
265
|
-
# b.update("users/frank", { nested_field_path
|
263
|
+
# b.update("users/frank", { nested_field_path => "Pasta" })
|
266
264
|
# end
|
267
265
|
#
|
268
266
|
# @example Update a document using a document reference:
|
@@ -170,9 +170,9 @@ module Google
|
|
170
170
|
##
|
171
171
|
# Retrieves a list of document snapshots.
|
172
172
|
#
|
173
|
-
# @param [String, DocumentReference]
|
174
|
-
# representing the path of the document, or
|
175
|
-
# objects.
|
173
|
+
# @param [String, DocumentReference, Array<String|DocumentReference>]
|
174
|
+
# docs One or more strings representing the path of the document, or
|
175
|
+
# document reference objects.
|
176
176
|
#
|
177
177
|
# @yield [documents] The block for accessing the document snapshots.
|
178
178
|
# @yieldparam [DocumentSnapshot] document A document snapshot.
|
@@ -238,10 +238,14 @@ module Google
|
|
238
238
|
end
|
239
239
|
|
240
240
|
##
|
241
|
-
# Creates a field path object representing
|
241
|
+
# Creates a field path object representing a nested field for
|
242
242
|
# document data.
|
243
243
|
#
|
244
|
-
# @
|
244
|
+
# @param [String, Symbol, Array<String|Symbol>] fields One or more
|
245
|
+
# strings representing the path of the data to select. Each field must
|
246
|
+
# be provided separately.
|
247
|
+
#
|
248
|
+
# @return [FieldPath] The field path object.
|
245
249
|
#
|
246
250
|
# @example
|
247
251
|
# require "google/cloud/firestore"
|
@@ -128,13 +128,13 @@ module Google
|
|
128
128
|
|
129
129
|
##
|
130
130
|
# The document reference or database the collection reference belongs
|
131
|
-
# to. If the collection is a root collection, it will return the
|
132
|
-
#
|
133
|
-
#
|
131
|
+
# to. If the collection is a root collection, it will return the client
|
132
|
+
# object. If the collection is nested under a document, it will return
|
133
|
+
# the document reference object.
|
134
134
|
#
|
135
|
-
# @return [
|
135
|
+
# @return [Client, DocumentReference] parent object.
|
136
136
|
#
|
137
|
-
# @example Returns
|
137
|
+
# @example Returns client object for root collections:
|
138
138
|
# require "google/cloud/firestore"
|
139
139
|
#
|
140
140
|
# firestore = Google::Cloud::Firestore.new
|
@@ -323,10 +323,8 @@ module Google
|
|
323
323
|
#
|
324
324
|
# user_ref = firestore.doc "users/frank"
|
325
325
|
#
|
326
|
-
# nested_field_path =
|
327
|
-
#
|
328
|
-
# )
|
329
|
-
# user_ref.update({ nested_field_path: "Pasta" })
|
326
|
+
# nested_field_path = firestore.field_path :favorites, :food
|
327
|
+
# user_ref.update({ nested_field_path => "Pasta" })
|
330
328
|
#
|
331
329
|
# @example Update a document using the `update_time` precondition:
|
332
330
|
# require "google/cloud/firestore"
|
@@ -42,6 +42,10 @@ module Google
|
|
42
42
|
# Creates a field path object representing a nested field for
|
43
43
|
# document data.
|
44
44
|
#
|
45
|
+
# @param [String, Symbol, Array<String|Symbol>] fields One or more
|
46
|
+
# strings representing the path of the data to select. Each field must
|
47
|
+
# be provided separately.
|
48
|
+
#
|
45
49
|
# @return [FieldPath] The field path object.
|
46
50
|
#
|
47
51
|
# @example
|
@@ -57,9 +57,9 @@ module Google
|
|
57
57
|
# Restricts documents matching the query to return only data for the
|
58
58
|
# provided fields.
|
59
59
|
#
|
60
|
-
# @param [FieldPath, String, Symbol]
|
61
|
-
# filter results with and return only the
|
62
|
-
# more field paths can be specified.
|
60
|
+
# @param [FieldPath, String, Symbol, Array<FieldPath|String|Symbol>]
|
61
|
+
# fields A field path to filter results with and return only the
|
62
|
+
# specified fields. One or more field paths can be specified.
|
63
63
|
#
|
64
64
|
# If a {FieldPath} object is not provided then the field will be
|
65
65
|
# treated as a dotted string, meaning the string represents individual
|
@@ -365,7 +365,8 @@ module Google
|
|
365
365
|
# Values provided to `start_at` without an associated field path
|
366
366
|
# provided to `order` will result in an error.
|
367
367
|
#
|
368
|
-
# @param [Object] values The field value to start the
|
368
|
+
# @param [Object, Array<Object>] values The field value to start the
|
369
|
+
# query at.
|
369
370
|
#
|
370
371
|
# @return [Query] New query with `start_at` called on it.
|
371
372
|
#
|
@@ -407,7 +408,8 @@ module Google
|
|
407
408
|
# Values provided to `start_after` without an associated field path
|
408
409
|
# provided to `order` will result in an error.
|
409
410
|
#
|
410
|
-
# @param [Object] values The field value to start the
|
411
|
+
# @param [Object, Array<Object>] values The field value to start the
|
412
|
+
# query after.
|
411
413
|
#
|
412
414
|
# @return [Query] New query with `start_after` called on it.
|
413
415
|
#
|
@@ -449,7 +451,8 @@ module Google
|
|
449
451
|
# Values provided to `end_before` without an associated field path
|
450
452
|
# provided to `order` will result in an error.
|
451
453
|
#
|
452
|
-
# @param [Object] values The field value to end the query
|
454
|
+
# @param [Object, Array<Object>] values The field value to end the query
|
455
|
+
# before.
|
453
456
|
#
|
454
457
|
# @return [Query] New query with `end_before` called on it.
|
455
458
|
#
|
@@ -491,7 +494,8 @@ module Google
|
|
491
494
|
# Values provided to `end_at` without an associated field path provided
|
492
495
|
# to `order` will result in an error.
|
493
496
|
#
|
494
|
-
# @param [Object] values The field value to end the query
|
497
|
+
# @param [Object, Array<Object>] values The field value to end the query
|
498
|
+
# at.
|
495
499
|
#
|
496
500
|
# @return [Query] New query with `end_at` called on it.
|
497
501
|
#
|
@@ -526,9 +530,9 @@ module Google
|
|
526
530
|
# Retrieves document snapshots for the query.
|
527
531
|
#
|
528
532
|
# @yield [documents] The block for accessing the document snapshots.
|
529
|
-
# @yieldparam [
|
533
|
+
# @yieldparam [DocumentSnapshot] document A document snapshot.
|
530
534
|
#
|
531
|
-
# @return [Enumerator<
|
535
|
+
# @return [Enumerator<DocumentSnapshot>] A list of document snapshots.
|
532
536
|
#
|
533
537
|
# @example
|
534
538
|
# require "google/cloud/firestore"
|
@@ -553,7 +557,7 @@ module Google
|
|
553
557
|
results = service.run_query parent_path, @query
|
554
558
|
results.each do |result|
|
555
559
|
next if result.document.nil?
|
556
|
-
yield DocumentSnapshot.from_query_result(result,
|
560
|
+
yield DocumentSnapshot.from_query_result(result, client)
|
557
561
|
end
|
558
562
|
end
|
559
563
|
alias run get
|
@@ -81,9 +81,9 @@ module Google
|
|
81
81
|
##
|
82
82
|
# Retrieves a list of document snapshots.
|
83
83
|
#
|
84
|
-
# @param [String, DocumentReference]
|
85
|
-
# representing the path of the document, or
|
86
|
-
# objects.
|
84
|
+
# @param [String, DocumentReference, Array<String|DocumentReference>]
|
85
|
+
# docs One or more strings representing the path of the document, or
|
86
|
+
# document reference objects.
|
87
87
|
#
|
88
88
|
# @yield [documents] The block for accessing the document snapshots.
|
89
89
|
# @yieldparam [DocumentSnapshot] document A document snapshot.
|
@@ -117,7 +117,7 @@ module Google
|
|
117
117
|
results.each do |result|
|
118
118
|
extract_transaction_from_result! result
|
119
119
|
next if result.result.nil?
|
120
|
-
yield DocumentSnapshot.from_batch_result(result,
|
120
|
+
yield DocumentSnapshot.from_batch_result(result, client)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
alias get_docs get_all
|
@@ -136,12 +136,12 @@ module Google
|
|
136
136
|
# to run.
|
137
137
|
#
|
138
138
|
# @yield [documents] The block for accessing the document snapshots.
|
139
|
-
# @yieldparam [
|
139
|
+
# @yieldparam [DocumentSnapshot] document A document snapshot.
|
140
140
|
#
|
141
|
-
# @return [
|
142
|
-
# single document snapshot when passed a document path a document
|
143
|
-
# reference, or a list of document snapshots when passed other
|
144
|
-
# values.
|
141
|
+
# @return [DocumentSnapshot, Enumerator<DocumentSnapshot>] A
|
142
|
+
# single document snapshot when passed a document path or a document
|
143
|
+
# reference object, or a list of document snapshots when passed other
|
144
|
+
# valid values.
|
145
145
|
#
|
146
146
|
# @example Get a document snapshot given a document path:
|
147
147
|
# require "google/cloud/firestore"
|
@@ -230,7 +230,7 @@ module Google
|
|
230
230
|
results.each do |result|
|
231
231
|
extract_transaction_from_result! result
|
232
232
|
next if result.document.nil?
|
233
|
-
yield DocumentSnapshot.from_query_result(result,
|
233
|
+
yield DocumentSnapshot.from_query_result(result, client)
|
234
234
|
end
|
235
235
|
end
|
236
236
|
alias run get
|
@@ -427,12 +427,10 @@ module Google
|
|
427
427
|
#
|
428
428
|
# firestore = Google::Cloud::Firestore.new
|
429
429
|
#
|
430
|
-
# nested_field_path =
|
431
|
-
# :favorites, :food
|
432
|
-
# )
|
430
|
+
# nested_field_path = firestore.field_path :favorites, :food
|
433
431
|
#
|
434
432
|
# firestore.transaction do |tx|
|
435
|
-
# tx.update("users/frank", { nested_field_path
|
433
|
+
# tx.update("users/frank", { nested_field_path => "Pasta" })
|
436
434
|
# end
|
437
435
|
#
|
438
436
|
# @example Update a document using a document reference:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-firestore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '0'
|
245
245
|
requirements: []
|
246
246
|
rubyforge_project:
|
247
|
-
rubygems_version: 2.7.
|
247
|
+
rubygems_version: 2.7.7
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: API Client library for Google Cloud Firestore API
|