ons-firestore 1.2.1 → 1.3.0
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 +2 -2
- 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: 4e6104269a49789359ba927ce1673d9e25b19afdd48caab6ae01f6ca4d99b757
|
4
|
+
data.tar.gz: 573ed986f15a3007c20d5196c67f590d34c260f68b0a3ff2314621eddf1e8a21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cce206bdc4f36f909304aef53704b0d51e6f6ba7dcb77af2d6f90d8adb4773dcf38c11893555da99c2f2fa2aad7cb3001fb012c409d6a4f053a51d9efe8712
|
7
|
+
data.tar.gz: 6e85af05d6baa2d6b364c743cda54c2027dd717af567baafb0f3df1350fa70817b9ee011b50eb44a05cfee6a892a08356e22730634894b0b679b65de5886ce03
|
@@ -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.0
|
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.
|