ons-firestore 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ons-firestore/firestore.rb +18 -0
- data/lib/ons-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: 69b4219eca0d252b55957168f6e4aca618dbbad9e1f74aef7817b5a0029c255e
|
4
|
+
data.tar.gz: f1903c35d349d6a9c01b078adbed46fe2c6b72317e579cdebe0d8dde7bae99ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfc82c60dec246a70e691192d71956d4e7fd4fbbe024fa21b62da45ecdbf48bc6f15c0a54b93c4ce543f5ead701bd76c22a968d0ca4782385c8f91c5fde09b2c
|
7
|
+
data.tar.gz: 4801011c5534fdfcdc9d31e1d27560d98e66982fc7f030a4fbebd16fe4a7d6c72e67d60fffd14fc11a98aaa0b23c1b94da9652e52e801ed16d4cd75e4440bce0
|
@@ -44,6 +44,24 @@ class Firestore
|
|
44
44
|
@client.col(collection_name).doc(document_name)
|
45
45
|
end
|
46
46
|
|
47
|
+
# Reads the +updated+ key within a Firestore document.
|
48
|
+
#
|
49
|
+
# @param collection_name [String] the name of the Firestore collection containing the document
|
50
|
+
# @param document_name [String] the name of the Firestore document
|
51
|
+
# @return [Object] document updated timestamp
|
52
|
+
# @raise [ArgumentError] if collection_name or document_name are nil
|
53
|
+
# @raise [FirestoreError] if the +updated+ key isn't present within the Firestore document
|
54
|
+
def document_updated(collection_name, document_name)
|
55
|
+
raise ArgumentError.new('collection_name cannot be nil') if collection_name.nil?
|
56
|
+
raise ArgumentError.new('document_name cannot be nil') if document_name.nil?
|
57
|
+
|
58
|
+
document = @client.col(collection_name).doc(document_name)
|
59
|
+
snapshot = document.get
|
60
|
+
raise FirestoreError, 'updated key is missing' if snapshot[:updated].nil?
|
61
|
+
|
62
|
+
snapshot[:updated]
|
63
|
+
end
|
64
|
+
|
47
65
|
# Reads the +data+ key within a Firestore document.
|
48
66
|
#
|
49
67
|
# @param collection_name [String] the name of the Firestore collection containing the document
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ons-firestore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Topley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-firestore
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.3.
|
102
|
+
rubygems_version: 3.3.15
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Opinionated Google Firestore abstraction.
|