google-cloud-firestore 2.9.1 → 2.10.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11756f53d816d451097f95dfbddda050a3cbdcaf5b732f227e7c2eed5770300b
|
4
|
+
data.tar.gz: 4b140ef2eefbc2c4f990b27b340fd39f30eb395e25173093b1d041754c2ac969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2961e4c3898492087255b15223c22136a30fa08984106c48e66fc8afc2ab6410df31d83ea4d96c03f484c0d1c6a093d8d976b192b03554c158a8880714b9d8e8
|
7
|
+
data.tar.gz: d9bc499cac0f2fa388ed139a50ddc1bc6ef380991a57a5cd8b38973b677b1f609d9d2c862472427870112690a28cf63a802a1be9cd2508a34ccf9da9734029d7
|
data/CHANGELOG.md
CHANGED
@@ -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.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: 2023-02-
|
11
|
+
date: 2023-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|