google-cloud-firestore 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/CHANGELOG.md +47 -0
  4. data/TROUBLESHOOTING.md +2 -8
  5. data/lib/google-cloud-firestore.rb +14 -21
  6. data/lib/google/cloud/firestore.rb +12 -23
  7. data/lib/google/cloud/firestore/client.rb +12 -14
  8. data/lib/google/cloud/firestore/collection_reference.rb +1 -0
  9. data/lib/google/cloud/firestore/collection_reference_list.rb +137 -0
  10. data/lib/google/cloud/firestore/convert.rb +39 -39
  11. data/lib/google/cloud/firestore/credentials.rb +2 -2
  12. data/lib/google/cloud/firestore/document_reference.rb +8 -8
  13. data/lib/google/cloud/firestore/document_reference/list.rb +2 -2
  14. data/lib/google/cloud/firestore/document_snapshot.rb +4 -4
  15. data/lib/google/cloud/firestore/query.rb +4 -4
  16. data/lib/google/cloud/firestore/service.rb +71 -106
  17. data/lib/google/cloud/firestore/transaction.rb +2 -2
  18. data/lib/google/cloud/firestore/version.rb +1 -1
  19. data/lib/google/cloud/firestore/watch/listener.rb +9 -9
  20. data/lib/google/cloud/firestore/watch/order.rb +1 -1
  21. metadata +11 -109
  22. data/lib/google/cloud/firestore/admin.rb +0 -144
  23. data/lib/google/cloud/firestore/admin/v1.rb +0 -151
  24. data/lib/google/cloud/firestore/admin/v1/credentials.rb +0 -44
  25. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/field.rb +0 -86
  26. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/firestore_admin.rb +0 -161
  27. data/lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/index.rb +0 -142
  28. data/lib/google/cloud/firestore/admin/v1/doc/google/longrunning/operations.rb +0 -51
  29. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/any.rb +0 -131
  30. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/empty.rb +0 -29
  31. data/lib/google/cloud/firestore/admin/v1/doc/google/protobuf/field_mask.rb +0 -222
  32. data/lib/google/cloud/firestore/admin/v1/doc/google/rpc/status.rb +0 -39
  33. data/lib/google/cloud/firestore/admin/v1/firestore_admin_client.rb +0 -764
  34. data/lib/google/cloud/firestore/admin/v1/firestore_admin_client_config.json +0 -72
  35. data/lib/google/cloud/firestore/v1.rb +0 -152
  36. data/lib/google/cloud/firestore/v1/credentials.rb +0 -42
  37. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb +0 -64
  38. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb +0 -136
  39. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb +0 -566
  40. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb +0 -227
  41. data/lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb +0 -241
  42. data/lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb +0 -131
  43. data/lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb +0 -29
  44. data/lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb +0 -113
  45. data/lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb +0 -26
  46. data/lib/google/cloud/firestore/v1/doc/google/rpc/status.rb +0 -39
  47. data/lib/google/cloud/firestore/v1/firestore_client.rb +0 -1073
  48. data/lib/google/cloud/firestore/v1/firestore_client_config.json +0 -101
  49. data/lib/google/cloud/firestore/v1beta1.rb +0 -160
  50. data/lib/google/cloud/firestore/v1beta1/credentials.rb +0 -42
  51. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb +0 -64
  52. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb +0 -136
  53. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb +0 -564
  54. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb +0 -227
  55. data/lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb +0 -237
  56. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb +0 -131
  57. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb +0 -29
  58. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  59. data/lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb +0 -26
  60. data/lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb +0 -39
  61. data/lib/google/cloud/firestore/v1beta1/firestore_client.rb +0 -1081
  62. data/lib/google/cloud/firestore/v1beta1/firestore_client_config.json +0 -100
  63. data/lib/google/firestore/admin/v1/field_pb.rb +0 -32
  64. data/lib/google/firestore/admin/v1/firestore_admin_pb.rb +0 -84
  65. data/lib/google/firestore/admin/v1/firestore_admin_services_pb.rb +0 -94
  66. data/lib/google/firestore/admin/v1/index_pb.rb +0 -58
  67. data/lib/google/firestore/admin/v1/location_pb.rb +0 -22
  68. data/lib/google/firestore/admin/v1/operation_pb.rb +0 -90
  69. data/lib/google/firestore/v1/common_pb.rb +0 -45
  70. data/lib/google/firestore/v1/document_pb.rb +0 -50
  71. data/lib/google/firestore/v1/firestore_pb.rb +0 -222
  72. data/lib/google/firestore/v1/firestore_services_pb.rb +0 -80
  73. data/lib/google/firestore/v1/query_pb.rb +0 -107
  74. data/lib/google/firestore/v1/write_pb.rb +0 -80
  75. data/lib/google/firestore/v1beta1/common_pb.rb +0 -45
  76. data/lib/google/firestore/v1beta1/document_pb.rb +0 -50
  77. data/lib/google/firestore/v1beta1/firestore_pb.rb +0 -222
  78. data/lib/google/firestore/v1beta1/firestore_services_pb.rb +0 -89
  79. data/lib/google/firestore/v1beta1/query_pb.rb +0 -107
  80. data/lib/google/firestore/v1beta1/write_pb.rb +0 -79
@@ -700,14 +700,14 @@ module Google
700
700
  # @private
701
701
  def transaction_opt
702
702
  read_write = \
703
- Google::Firestore::V1::TransactionOptions::ReadWrite.new
703
+ Google::Cloud::Firestore::V1::TransactionOptions::ReadWrite.new
704
704
 
705
705
  if @previous_transaction
706
706
  read_write.retry_transaction = @previous_transaction
707
707
  @previous_transaction = nil
708
708
  end
709
709
 
710
- Google::Firestore::V1::TransactionOptions.new(
710
+ Google::Cloud::Firestore::V1::TransactionOptions.new(
711
711
  read_write: read_write
712
712
  )
713
713
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Firestore
19
- VERSION = "1.4.0".freeze
19
+ VERSION = "2.0.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -34,12 +34,12 @@ module Google
34
34
  raise ArgumentError if doc_ref.nil?
35
35
  raise ArgumentError if callback.nil?
36
36
 
37
- documents = Google::Firestore::V1::Target::DocumentsTarget.new(
37
+ documents = Google::Cloud::Firestore::V1::Target::DocumentsTarget.new(
38
38
  documents: [doc_ref.path]
39
39
  )
40
- init_listen_req = Google::Firestore::V1::ListenRequest.new(
40
+ init_listen_req = Google::Cloud::Firestore::V1::ListenRequest.new(
41
41
  database: doc_ref.client.path,
42
- add_target: Google::Firestore::V1::Target.new(
42
+ add_target: Google::Cloud::Firestore::V1::Target.new(
43
43
  documents: documents
44
44
  )
45
45
  )
@@ -51,10 +51,10 @@ module Google
51
51
  raise ArgumentError if query.nil?
52
52
  raise ArgumentError if callback.nil?
53
53
 
54
- init_listen_req = Google::Firestore::V1::ListenRequest.new(
54
+ init_listen_req = Google::Cloud::Firestore::V1::ListenRequest.new(
55
55
  database: query.client.path,
56
- add_target: Google::Firestore::V1::Target.new(
57
- query: Google::Firestore::V1::Target::QueryTarget.new(
56
+ add_target: Google::Cloud::Firestore::V1::Target.new(
57
+ query: Google::Cloud::Firestore::V1::Target::QueryTarget.new(
58
58
  parent: query.parent_path,
59
59
  structured_query: query.query
60
60
  )
@@ -223,7 +223,7 @@ module Google
223
223
  raise RestartStream # Raise to restart the stream
224
224
  end
225
225
  when :document_change
226
- # A {Google::Firestore::V1::Document Document} has changed.
226
+ # A {Google::Cloud::Firestore::V1::Document Document} has changed.
227
227
 
228
228
  if response.document_change.removed_target_ids.any?
229
229
  @inventory.delete response.document_change.document.name
@@ -231,12 +231,12 @@ module Google
231
231
  @inventory.add response.document_change.document
232
232
  end
233
233
  when :document_delete
234
- # A {Google::Firestore::V1::Document Document} has been
234
+ # A {Google::Cloud::Firestore::V1::Document Document} has been
235
235
  # deleted.
236
236
 
237
237
  @inventory.delete response.document_delete.document
238
238
  when :document_remove
239
- # A {Google::Firestore::V1::Document Document} has been
239
+ # A {Google::Cloud::Firestore::V1::Document Document} has been
240
240
  # removed from a target (because it is no longer relevant to
241
241
  # that target).
242
242
 
@@ -77,7 +77,7 @@ module Google
77
77
  return value if value.is_a? String
78
78
  return value.string if value.is_a? StringIO
79
79
  if value.is_a? DocumentReference
80
- return value.path.split "/".freeze
80
+ return value.path.split "/"
81
81
  end
82
82
  return value.map { |v| field_comparison v } if value.is_a? Array
83
83
  if value.is_a? Hash
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: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-11 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core
@@ -16,68 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.2'
19
+ version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.2'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: google-gax
28
+ name: google-cloud-firestore-v1
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.8'
33
+ version: '0.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.8'
41
- - !ruby/object:Gem::Dependency
42
- name: googleapis-common-protos
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.3.9
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '2.0'
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 1.3.9
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: '2.0'
61
- - !ruby/object:Gem::Dependency
62
- name: googleapis-common-protos-types
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: 1.0.4
68
- - - "<"
69
- - !ruby/object:Gem::Version
70
- version: '2.0'
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: 1.0.4
78
- - - "<"
79
- - !ruby/object:Gem::Version
80
- version: '2.0'
40
+ version: '0.0'
81
41
  - !ruby/object:Gem::Dependency
82
42
  name: concurrent-ruby
83
43
  requirement: !ruby/object:Gem::Requirement
@@ -126,14 +86,14 @@ dependencies:
126
86
  requirements:
127
87
  - - "~>"
128
88
  - !ruby/object:Gem::Version
129
- version: '5.10'
89
+ version: '5.14'
130
90
  type: :development
131
91
  prerelease: false
132
92
  version_requirements: !ruby/object:Gem::Requirement
133
93
  requirements:
134
94
  - - "~>"
135
95
  - !ruby/object:Gem::Version
136
- version: '5.10'
96
+ version: '5.14'
137
97
  - !ruby/object:Gem::Dependency
138
98
  name: minitest-autotest
139
99
  requirement: !ruby/object:Gem::Requirement
@@ -265,22 +225,10 @@ files:
265
225
  - TROUBLESHOOTING.md
266
226
  - lib/google-cloud-firestore.rb
267
227
  - lib/google/cloud/firestore.rb
268
- - lib/google/cloud/firestore/admin.rb
269
- - lib/google/cloud/firestore/admin/v1.rb
270
- - lib/google/cloud/firestore/admin/v1/credentials.rb
271
- - lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/field.rb
272
- - lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/firestore_admin.rb
273
- - lib/google/cloud/firestore/admin/v1/doc/google/firestore/admin/v1/index.rb
274
- - lib/google/cloud/firestore/admin/v1/doc/google/longrunning/operations.rb
275
- - lib/google/cloud/firestore/admin/v1/doc/google/protobuf/any.rb
276
- - lib/google/cloud/firestore/admin/v1/doc/google/protobuf/empty.rb
277
- - lib/google/cloud/firestore/admin/v1/doc/google/protobuf/field_mask.rb
278
- - lib/google/cloud/firestore/admin/v1/doc/google/rpc/status.rb
279
- - lib/google/cloud/firestore/admin/v1/firestore_admin_client.rb
280
- - lib/google/cloud/firestore/admin/v1/firestore_admin_client_config.json
281
228
  - lib/google/cloud/firestore/batch.rb
282
229
  - lib/google/cloud/firestore/client.rb
283
230
  - lib/google/cloud/firestore/collection_reference.rb
231
+ - lib/google/cloud/firestore/collection_reference_list.rb
284
232
  - lib/google/cloud/firestore/commit_response.rb
285
233
  - lib/google/cloud/firestore/convert.rb
286
234
  - lib/google/cloud/firestore/credentials.rb
@@ -297,57 +245,11 @@ files:
297
245
  - lib/google/cloud/firestore/query_snapshot.rb
298
246
  - lib/google/cloud/firestore/service.rb
299
247
  - lib/google/cloud/firestore/transaction.rb
300
- - lib/google/cloud/firestore/v1.rb
301
- - lib/google/cloud/firestore/v1/credentials.rb
302
- - lib/google/cloud/firestore/v1/doc/google/firestore/v1/common.rb
303
- - lib/google/cloud/firestore/v1/doc/google/firestore/v1/document.rb
304
- - lib/google/cloud/firestore/v1/doc/google/firestore/v1/firestore.rb
305
- - lib/google/cloud/firestore/v1/doc/google/firestore/v1/query.rb
306
- - lib/google/cloud/firestore/v1/doc/google/firestore/v1/write.rb
307
- - lib/google/cloud/firestore/v1/doc/google/protobuf/any.rb
308
- - lib/google/cloud/firestore/v1/doc/google/protobuf/empty.rb
309
- - lib/google/cloud/firestore/v1/doc/google/protobuf/timestamp.rb
310
- - lib/google/cloud/firestore/v1/doc/google/protobuf/wrappers.rb
311
- - lib/google/cloud/firestore/v1/doc/google/rpc/status.rb
312
- - lib/google/cloud/firestore/v1/firestore_client.rb
313
- - lib/google/cloud/firestore/v1/firestore_client_config.json
314
- - lib/google/cloud/firestore/v1beta1.rb
315
- - lib/google/cloud/firestore/v1beta1/credentials.rb
316
- - lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/common.rb
317
- - lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/document.rb
318
- - lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/firestore.rb
319
- - lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/query.rb
320
- - lib/google/cloud/firestore/v1beta1/doc/google/firestore/v1beta1/write.rb
321
- - lib/google/cloud/firestore/v1beta1/doc/google/protobuf/any.rb
322
- - lib/google/cloud/firestore/v1beta1/doc/google/protobuf/empty.rb
323
- - lib/google/cloud/firestore/v1beta1/doc/google/protobuf/timestamp.rb
324
- - lib/google/cloud/firestore/v1beta1/doc/google/protobuf/wrappers.rb
325
- - lib/google/cloud/firestore/v1beta1/doc/google/rpc/status.rb
326
- - lib/google/cloud/firestore/v1beta1/firestore_client.rb
327
- - lib/google/cloud/firestore/v1beta1/firestore_client_config.json
328
248
  - lib/google/cloud/firestore/version.rb
329
249
  - lib/google/cloud/firestore/watch/enumerator_queue.rb
330
250
  - lib/google/cloud/firestore/watch/inventory.rb
331
251
  - lib/google/cloud/firestore/watch/listener.rb
332
252
  - lib/google/cloud/firestore/watch/order.rb
333
- - lib/google/firestore/admin/v1/field_pb.rb
334
- - lib/google/firestore/admin/v1/firestore_admin_pb.rb
335
- - lib/google/firestore/admin/v1/firestore_admin_services_pb.rb
336
- - lib/google/firestore/admin/v1/index_pb.rb
337
- - lib/google/firestore/admin/v1/location_pb.rb
338
- - lib/google/firestore/admin/v1/operation_pb.rb
339
- - lib/google/firestore/v1/common_pb.rb
340
- - lib/google/firestore/v1/document_pb.rb
341
- - lib/google/firestore/v1/firestore_pb.rb
342
- - lib/google/firestore/v1/firestore_services_pb.rb
343
- - lib/google/firestore/v1/query_pb.rb
344
- - lib/google/firestore/v1/write_pb.rb
345
- - lib/google/firestore/v1beta1/common_pb.rb
346
- - lib/google/firestore/v1beta1/document_pb.rb
347
- - lib/google/firestore/v1beta1/firestore_pb.rb
348
- - lib/google/firestore/v1beta1/firestore_services_pb.rb
349
- - lib/google/firestore/v1beta1/query_pb.rb
350
- - lib/google/firestore/v1beta1/write_pb.rb
351
253
  homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-firestore
352
254
  licenses:
353
255
  - Apache-2.0
@@ -367,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
269
  - !ruby/object:Gem::Version
368
270
  version: '0'
369
271
  requirements: []
370
- rubygems_version: 3.0.6
272
+ rubygems_version: 3.1.3
371
273
  signing_key:
372
274
  specification_version: 4
373
275
  summary: API Client library for Google Cloud Firestore API
@@ -1,144 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "google/gax"
17
- require "pathname"
18
-
19
- module Google
20
- module Cloud
21
- module Firestore
22
- # rubocop:disable LineLength
23
-
24
- ##
25
- # # Ruby Client for Google Cloud Firestore Admin API
26
- #
27
- # [Google Cloud Firestore Admin API][Product Documentation]:
28
- # Accesses the NoSQL document database built for automatic scaling, high
29
- # performance, and ease of application development.
30
- # - [Product Documentation][]
31
- #
32
- # ## Quick Start
33
- # In order to use this library, you first need to go through the following
34
- # steps:
35
- #
36
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Google Cloud Firestore Admin API.](https://console.cloud.google.com/apis/library/firestore-admin.googleapis.com)
39
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-firestore/latest/file.AUTHENTICATION.html)
40
- #
41
- # ### Installation
42
- # ```
43
- # $ gem install google-cloud-firestore-admin
44
- # ```
45
- #
46
- # ### Next Steps
47
- # - Read the [Google Cloud Firestore Admin API Product documentation][Product Documentation]
48
- # to learn more about the product and see How-to Guides.
49
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
50
- # to see the full list of Cloud APIs that we cover.
51
- #
52
- # [Product Documentation]: https://cloud.google.com/firestore-admin
53
- #
54
- # ## Enabling Logging
55
- #
56
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
57
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
58
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
59
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
60
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
61
- #
62
- # Configuring a Ruby stdlib logger:
63
- #
64
- # ```ruby
65
- # require "logger"
66
- #
67
- # module MyLogger
68
- # LOGGER = Logger.new $stderr, level: Logger::WARN
69
- # def logger
70
- # LOGGER
71
- # end
72
- # end
73
- #
74
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
75
- # module GRPC
76
- # extend MyLogger
77
- # end
78
- # ```
79
- #
80
- module Admin
81
- # rubocop:enable LineLength
82
-
83
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("admin"))
84
-
85
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
86
- .select { |file| File.directory?(file) }
87
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
88
- .select { |dir| File.exist?(dir + ".rb") }
89
- .map { |dir| File.basename(dir) }
90
-
91
- ##
92
- # Operations are created by service `FirestoreAdmin`, but are accessed via
93
- # service `google.longrunning.Operations`.
94
- #
95
- # @param version [Symbol, String]
96
- # The major version of the service to be used. By default :v1
97
- # is used.
98
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
99
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
100
- # Provides the means for authenticating requests made by the client. This parameter can
101
- # be many types.
102
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
103
- # authenticating requests made by this client.
104
- # A `String` will be treated as the path to the keyfile to be used for the construction of
105
- # credentials for this client.
106
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
107
- # credentials for this client.
108
- # A `GRPC::Core::Channel` will be used to make calls through.
109
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
110
- # should already be composed with a `GRPC::Core::CallCredentials` object.
111
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
112
- # metadata for requests, generally, to give OAuth credentials.
113
- # @param scopes [Array<String>]
114
- # The OAuth scopes for this service. This parameter is ignored if
115
- # an updater_proc is supplied.
116
- # @param client_config [Hash]
117
- # A Hash for call options for each method. See
118
- # Google::Gax#construct_settings for the structure of
119
- # this data. Falls back to the default config if not specified
120
- # or the specified config is missing data points.
121
- # @param timeout [Numeric]
122
- # The default timeout, in seconds, for calls made through this client.
123
- # @param metadata [Hash]
124
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
125
- # @param exception_transformer [Proc]
126
- # An optional proc that intercepts any exceptions raised during an API call to inject
127
- # custom error handling.
128
- def self.new(*args, version: :v1, **kwargs)
129
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
130
- raise "The version: #{version} is not available. The available versions " \
131
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
132
- end
133
-
134
- require "#{FILE_DIR}/#{version.to_s.downcase}"
135
- version_module = Google::Cloud::Firestore::Admin
136
- .constants
137
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
138
- .first
139
- Google::Cloud::Firestore::Admin.const_get(version_module).new(*args, **kwargs)
140
- end
141
- end
142
- end
143
- end
144
- end
@@ -1,151 +0,0 @@
1
- # Copyright 2020 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "google/cloud/firestore/admin/v1/firestore_admin_client"
17
- require "google/firestore/admin/v1/operation_pb"
18
- require "google/firestore/admin/v1/location_pb"
19
-
20
- module Google
21
- module Cloud
22
- module Firestore
23
- module Admin
24
- # rubocop:disable LineLength
25
-
26
- ##
27
- # # Ruby Client for Google Cloud Firestore Admin API
28
- #
29
- # [Google Cloud Firestore Admin API][Product Documentation]:
30
- # Accesses the NoSQL document database built for automatic scaling, high
31
- # performance, and ease of application development.
32
- # - [Product Documentation][]
33
- #
34
- # ## Quick Start
35
- # In order to use this library, you first need to go through the following
36
- # steps:
37
- #
38
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
39
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
40
- # 3. [Enable the Google Cloud Firestore Admin API.](https://console.cloud.google.com/apis/library/firestore-admin.googleapis.com)
41
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-firestore/latest/file.AUTHENTICATION.html)
42
- #
43
- # ### Installation
44
- # ```
45
- # $ gem install google-cloud-firestore-admin
46
- # ```
47
- #
48
- # ### Next Steps
49
- # - Read the [Google Cloud Firestore Admin API Product documentation][Product Documentation]
50
- # to learn more about the product and see How-to Guides.
51
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
52
- # to see the full list of Cloud APIs that we cover.
53
- #
54
- # [Product Documentation]: https://cloud.google.com/firestore-admin
55
- #
56
- # ## Enabling Logging
57
- #
58
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
59
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
60
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
61
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
62
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
63
- #
64
- # Configuring a Ruby stdlib logger:
65
- #
66
- # ```ruby
67
- # require "logger"
68
- #
69
- # module MyLogger
70
- # LOGGER = Logger.new $stderr, level: Logger::WARN
71
- # def logger
72
- # LOGGER
73
- # end
74
- # end
75
- #
76
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
77
- # module GRPC
78
- # extend MyLogger
79
- # end
80
- # ```
81
- #
82
- module V1
83
- # rubocop:enable LineLength
84
-
85
- ##
86
- # Operations are created by service `FirestoreAdmin`, but are accessed via
87
- # service `google.longrunning.Operations`.
88
- #
89
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
90
- # Provides the means for authenticating requests made by the client. This parameter can
91
- # be many types.
92
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
93
- # authenticating requests made by this client.
94
- # A `String` will be treated as the path to the keyfile to be used for the construction of
95
- # credentials for this client.
96
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
97
- # credentials for this client.
98
- # A `GRPC::Core::Channel` will be used to make calls through.
99
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
100
- # should already be composed with a `GRPC::Core::CallCredentials` object.
101
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
102
- # metadata for requests, generally, to give OAuth credentials.
103
- # @param scopes [Array<String>]
104
- # The OAuth scopes for this service. This parameter is ignored if
105
- # an updater_proc is supplied.
106
- # @param client_config [Hash]
107
- # A Hash for call options for each method. See
108
- # Google::Gax#construct_settings for the structure of
109
- # this data. Falls back to the default config if not specified
110
- # or the specified config is missing data points.
111
- # @param timeout [Numeric]
112
- # The default timeout, in seconds, for calls made through this client.
113
- # @param metadata [Hash]
114
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
115
- # @param service_address [String]
116
- # Override for the service hostname, or `nil` to leave as the default.
117
- # @param service_port [Integer]
118
- # Override for the service port, or `nil` to leave as the default.
119
- # @param exception_transformer [Proc]
120
- # An optional proc that intercepts any exceptions raised during an API call to inject
121
- # custom error handling.
122
- def self.new \
123
- credentials: nil,
124
- scopes: nil,
125
- client_config: nil,
126
- timeout: nil,
127
- metadata: nil,
128
- service_address: nil,
129
- service_port: nil,
130
- exception_transformer: nil,
131
- lib_name: nil,
132
- lib_version: nil
133
- kwargs = {
134
- credentials: credentials,
135
- scopes: scopes,
136
- client_config: client_config,
137
- timeout: timeout,
138
- metadata: metadata,
139
- exception_transformer: exception_transformer,
140
- lib_name: lib_name,
141
- service_address: service_address,
142
- service_port: service_port,
143
- lib_version: lib_version
144
- }.select { |_, v| v != nil }
145
- Google::Cloud::Firestore::Admin::V1::FirestoreAdminClient.new(**kwargs)
146
- end
147
- end
148
- end
149
- end
150
- end
151
- end