google-cloud-firestore 2.9.1 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/google/cloud/firestore/client.rb +1 -1
- data/lib/google/cloud/firestore/service.rb +7 -5
- data/lib/google/cloud/firestore/version.rb +1 -1
- data/lib/google/cloud/firestore.rb +12 -6
- data/lib/google-cloud-firestore.rb +20 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6f5f652c19f42202037ab6ea3281e24a0a78a73749b9ad0a3eea4e5028c934d
|
4
|
+
data.tar.gz: b8f499a9749fe11b7eabe4998e2b51660c85083edadf89bc5aeedcdd60c0e363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c482b86c7d6a2f6fab119cb6056d2d9e34a45449496b154ed023bb81fec17a54a597cee2be7708ab6b630d5b46f76fe406899fcd3b8389a177199ac46f009a8
|
7
|
+
data.tar.gz: '0944612066e1adcf21269961ec377e9b6ca3e809058328e5b002cfc0b80c5303c233420316ead38df278615092b6c3752fa47f55942054d378d2f4d9cd9f18f8'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.10.1 (2023-02-16)
|
4
|
+
|
5
|
+
#### Bug Fixes
|
6
|
+
|
7
|
+
* update version of firestore-v1 in gemspec ([#20433](https://github.com/googleapis/google-cloud-ruby/issues/20433))
|
8
|
+
|
9
|
+
### 2.10.0 (2023-02-09)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Added support for multiple databases ([#20029](https://github.com/googleapis/google-cloud-ruby/issues/20029))
|
14
|
+
|
3
15
|
### 2.9.1 (2023-02-03)
|
4
16
|
|
5
17
|
#### Bug Fixes
|
@@ -30,14 +30,16 @@ module Google
|
|
30
30
|
attr_accessor :credentials
|
31
31
|
attr_accessor :timeout
|
32
32
|
attr_accessor :host
|
33
|
+
attr_accessor :database
|
33
34
|
|
34
35
|
##
|
35
36
|
# Creates a new Service instance.
|
36
|
-
def initialize project, credentials, host: nil, timeout: nil
|
37
|
+
def initialize project, credentials, host: nil, timeout: nil, database: nil
|
37
38
|
@project = project
|
38
39
|
@credentials = credentials
|
39
40
|
@host = host
|
40
41
|
@timeout = timeout
|
42
|
+
@database = database
|
41
43
|
end
|
42
44
|
|
43
45
|
def firestore
|
@@ -48,7 +50,7 @@ module Google
|
|
48
50
|
config.endpoint = host if host
|
49
51
|
config.lib_name = "gccl"
|
50
52
|
config.lib_version = Google::Cloud::Firestore::VERSION
|
51
|
-
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}/databases
|
53
|
+
config.metadata = { "google-cloud-resource-prefix": "projects/#{@project}/databases/#{@database}" }
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -181,18 +183,18 @@ module Google
|
|
181
183
|
)
|
182
184
|
end
|
183
185
|
|
184
|
-
def database_path project_id: project, database_id:
|
186
|
+
def database_path project_id: project, database_id: database
|
185
187
|
# Originally used V1::FirestoreClient.database_root_path until it was removed in #5405.
|
186
188
|
"projects/#{project_id}/databases/#{database_id}"
|
187
189
|
end
|
188
190
|
|
189
|
-
def documents_path project_id: project, database_id:
|
191
|
+
def documents_path project_id: project, database_id: database
|
190
192
|
# Originally used V1::FirestoreClient.document_root_path until it was removed in #5405.
|
191
193
|
"projects/#{project_id}/databases/#{database_id}/documents"
|
192
194
|
end
|
193
195
|
|
194
196
|
def inspect
|
195
|
-
"#{self.class}(#{@project})"
|
197
|
+
"#{self.class}(#{@project})(#{@database})"
|
196
198
|
end
|
197
199
|
|
198
200
|
def read_time_to_timestamp read_time
|
@@ -59,6 +59,8 @@ module Google
|
|
59
59
|
# If the param is nil, uses the default endpoint.
|
60
60
|
# @param [String] emulator_host Firestore emulator host. Optional.
|
61
61
|
# If the param is nil, uses the value of the `emulator_host` config.
|
62
|
+
# @param [String] database_id Identifier for a Firestore database. If not
|
63
|
+
# present, the default database of the project is used.
|
62
64
|
# @param [String] project Alias for the `project_id` argument. Deprecated.
|
63
65
|
# @param [String] keyfile Alias for the `credentials` argument.
|
64
66
|
# Deprecated.
|
@@ -76,19 +78,22 @@ module Google
|
|
76
78
|
timeout: nil,
|
77
79
|
endpoint: nil,
|
78
80
|
emulator_host: nil,
|
81
|
+
database_id: nil,
|
79
82
|
project: nil,
|
80
83
|
keyfile: nil
|
81
|
-
project_id
|
82
|
-
scope
|
83
|
-
timeout
|
84
|
-
endpoint
|
84
|
+
project_id ||= (project || default_project_id)
|
85
|
+
scope ||= configure.scope
|
86
|
+
timeout ||= configure.timeout
|
87
|
+
endpoint ||= configure.endpoint
|
85
88
|
emulator_host ||= configure.emulator_host
|
89
|
+
database_id ||= configure.database_id
|
86
90
|
|
87
91
|
if emulator_host
|
88
92
|
project_id = project_id.to_s
|
89
93
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
90
94
|
|
91
|
-
service = Firestore::Service.new project_id, :this_channel_is_insecure, host: emulator_host,
|
95
|
+
service = Firestore::Service.new project_id, :this_channel_is_insecure, host: emulator_host,
|
96
|
+
timeout: timeout, database: database_id
|
92
97
|
return Firestore::Client.new service
|
93
98
|
end
|
94
99
|
|
@@ -103,7 +108,8 @@ module Google
|
|
103
108
|
project_id = project_id.to_s
|
104
109
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
105
110
|
|
106
|
-
service = Firestore::Service.new project_id, credentials, host: endpoint,
|
111
|
+
service = Firestore::Service.new project_id, credentials, host: endpoint,
|
112
|
+
timeout: timeout, database: database_id
|
107
113
|
Firestore::Client.new service
|
108
114
|
end
|
109
115
|
|
@@ -42,6 +42,8 @@ module Google
|
|
42
42
|
#
|
43
43
|
# * `https://www.googleapis.com/auth/datastore`
|
44
44
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
45
|
+
# @param [String] database_id Identifier for a Firestore database. If not
|
46
|
+
# present, the default database of the project is used.
|
45
47
|
#
|
46
48
|
# @return [Google::Cloud::Firestore::Client]
|
47
49
|
#
|
@@ -58,8 +60,15 @@ module Google
|
|
58
60
|
# platform_scope = "https://www.googleapis.com/auth/cloud-platform"
|
59
61
|
# firestore = gcloud.firestore scope: platform_scope
|
60
62
|
#
|
61
|
-
|
62
|
-
|
63
|
+
# @example The default database can be overridden with the `database_id` option:
|
64
|
+
# require "google/cloud"
|
65
|
+
#
|
66
|
+
# gcloud = Google::Cloud.new
|
67
|
+
# database_id = "my-todo-database"
|
68
|
+
# firestore = gcloud.firestore database_id: database_id
|
69
|
+
#
|
70
|
+
def firestore scope: nil, timeout: nil, database_id: nil
|
71
|
+
Google::Cloud.firestore @project, @keyfile, scope: scope, timeout: (timeout || @timeout), database_id: database_id
|
63
72
|
end
|
64
73
|
|
65
74
|
##
|
@@ -83,6 +92,8 @@ module Google
|
|
83
92
|
#
|
84
93
|
# * `https://www.googleapis.com/auth/datastore`
|
85
94
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
95
|
+
# @param [String] database_id Identifier for a Firestore database. If not
|
96
|
+
# present, the default database of the project is used.
|
86
97
|
#
|
87
98
|
# @return [Google::Cloud::Firestore::Client]
|
88
99
|
#
|
@@ -91,12 +102,13 @@ module Google
|
|
91
102
|
#
|
92
103
|
# firestore = Google::Cloud.firestore
|
93
104
|
#
|
94
|
-
def self.firestore project_id = nil, credentials = nil, scope: nil, timeout: nil
|
105
|
+
def self.firestore project_id = nil, credentials = nil, scope: nil, timeout: nil, database_id: nil
|
95
106
|
require "google/cloud/firestore"
|
96
|
-
Google::Cloud::Firestore.new project_id:
|
107
|
+
Google::Cloud::Firestore.new project_id: project_id,
|
97
108
|
credentials: credentials,
|
98
|
-
scope:
|
99
|
-
timeout:
|
109
|
+
scope: scope,
|
110
|
+
timeout: timeout,
|
111
|
+
database_id: database_id
|
100
112
|
end
|
101
113
|
end
|
102
114
|
end
|
@@ -116,8 +128,7 @@ Google::Cloud.configure.add_config! :firestore do |config|
|
|
116
128
|
ENV["FIRESTORE_EMULATOR_HOST"]
|
117
129
|
end
|
118
130
|
default_scopes = [
|
119
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
120
|
-
"https://www.googleapis.com/auth/datastore"
|
131
|
+
"https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/datastore"
|
121
132
|
]
|
122
133
|
|
123
134
|
config.add_field! :project_id, default_project, match: String, allow_nil: true
|
@@ -129,4 +140,5 @@ Google::Cloud.configure.add_config! :firestore do |config|
|
|
129
140
|
config.add_field! :timeout, nil, match: Integer
|
130
141
|
config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
|
131
142
|
config.add_field! :endpoint, "firestore.googleapis.com", match: String
|
143
|
+
config.add_field! :database_id, "(default)", match: String
|
132
144
|
end
|
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: 2.
|
4
|
+
version: 2.10.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: 2023-02-
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.8'
|
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: '0.
|
40
|
+
version: '0.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: concurrent-ruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|