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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffae582656edb80c22028523bd1b307e9878e20450ee25a2bba2924da506eb19
4
- data.tar.gz: cdbe8832c4f0a5d49fbf340530b8d1f3211ebf6bf50e49814b8e382ec7433224
3
+ metadata.gz: 69b4219eca0d252b55957168f6e4aca618dbbad9e1f74aef7817b5a0029c255e
4
+ data.tar.gz: f1903c35d349d6a9c01b078adbed46fe2c6b72317e579cdebe0d8dde7bae99ff
5
5
  SHA512:
6
- metadata.gz: fcbc120f1016150d54bff96aee74d5d2d772c807a7d17c6bb8da58f9728d899ef1ff543688c2b96229c1a87c63ff9fb5845100383f444a9970b1d71454378ce3
7
- data.tar.gz: 6f408ae0027ca9fc946acfc006081a5b018f837e0f8a5ada236d4d0f8aa826ef46fb2ed2bcdc712b960e6ea72a9fe22625d581968f95f6da5f4bc7b717609945
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
@@ -3,7 +3,7 @@
3
3
  module ONSFirestore
4
4
  module Version
5
5
  MAJOR = 1
6
- MINOR = 2
6
+ MINOR = 3
7
7
  TINY = 1
8
8
  end
9
9
  VERSION = [Version::MAJOR, Version::MINOR, Version::TINY].compact * '.'
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.2.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: 2022-05-06 00:00:00.000000000 Z
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.3
102
+ rubygems_version: 3.3.15
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Opinionated Google Firestore abstraction.