google-cloud-translate 3.10.0 → 3.10.1
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 +4 -4
- data/lib/google/cloud/translate/helpers.rb +31 -8
- data/lib/google/cloud/translate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c900d0400d549fffda0001b4c82909aacd5a8673cbde7a921867cd291c26e682
|
|
4
|
+
data.tar.gz: f9ba1c7887bdcf04cfa8b3697703fe542e2abdf5fb6e1ff8b3b5ad882d0974c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 805817b8127ee793b0bbb0b87d7df17aae1fed3018ceeba9a525bc981843aad4d98a09bb2a72c2bf5e50f0a7f73fd65f68dfc9bfdac20163159b5abe97fb07d1
|
|
7
|
+
data.tar.gz: 3b9e96e215fe4726171ea956a271c428ea669743845fb752e443b8d3ccf02713e58e21f56cce3f4bbbbd4903e16e27e5e9ab365ba86c582dbbe96ddc1d105897
|
|
@@ -47,6 +47,8 @@ module Google
|
|
|
47
47
|
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
|
48
48
|
# @param [String] endpoint Override of the endpoint host name. Optional. If the param is nil, uses the default
|
|
49
49
|
# endpoint.
|
|
50
|
+
# @param [String] universe_domain Override of the universe domain. Optional. If the param is nil, uses the
|
|
51
|
+
# configured `universe_domain`, `ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"]`, or `"googleapis.com"`.
|
|
50
52
|
#
|
|
51
53
|
# @return [Google::Cloud::Translate::V2::Api]
|
|
52
54
|
#
|
|
@@ -93,15 +95,36 @@ module Google
|
|
|
93
95
|
scope: nil,
|
|
94
96
|
retries: nil,
|
|
95
97
|
timeout: nil,
|
|
96
|
-
endpoint: nil
|
|
98
|
+
endpoint: nil,
|
|
99
|
+
universe_domain: nil
|
|
97
100
|
require "google/cloud/translate/v2"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
options = {
|
|
102
|
+
project_id: project_id,
|
|
103
|
+
credentials: credentials,
|
|
104
|
+
key: key,
|
|
105
|
+
scope: scope,
|
|
106
|
+
retries: retries,
|
|
107
|
+
timeout: timeout,
|
|
108
|
+
endpoint: endpoint
|
|
109
|
+
}
|
|
110
|
+
# `Translate::V2.new` shares `Google::Cloud.configure.translate` (via
|
|
111
|
+
# `V2.translation_config`) and `ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"]`.
|
|
112
|
+
# Forward explicit `universe_domain` arguments verbatim, and forward
|
|
113
|
+
# non-default configured/ENV universes so `google-cloud-translate-v2 <= 1.2.1`
|
|
114
|
+
# fails closed with `ArgumentError` instead of silently routing to
|
|
115
|
+
# `googleapis.com`, while keeping GDU callers (unset or `"googleapis.com"`)
|
|
116
|
+
# compatible with older V2 gems.
|
|
117
|
+
if universe_domain.nil?
|
|
118
|
+
configured_universe = configure.universe_domain
|
|
119
|
+
configured_universe = ENV["GOOGLE_CLOUD_UNIVERSE_DOMAIN"]&.strip if configured_universe.nil?
|
|
120
|
+
if !configured_universe.nil? && !configured_universe.empty? && configured_universe != "googleapis.com"
|
|
121
|
+
options[:universe_domain] = configured_universe
|
|
122
|
+
end
|
|
123
|
+
else
|
|
124
|
+
options[:universe_domain] = universe_domain
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
Google::Cloud::Translate::V2.new(**options)
|
|
105
128
|
end
|
|
106
129
|
|
|
107
130
|
# Additional config keys used by V2
|