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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aef4d872abcf9e3ab8c20a52f842038306718dcc1fd723f9f1044c9c7fbc3007
4
- data.tar.gz: 021301c2b2dca34f6645b90dc0bfa3b3bce4b3ead8308c18060df8c4ad3976e5
3
+ metadata.gz: c900d0400d549fffda0001b4c82909aacd5a8673cbde7a921867cd291c26e682
4
+ data.tar.gz: f9ba1c7887bdcf04cfa8b3697703fe542e2abdf5fb6e1ff8b3b5ad882d0974c6
5
5
  SHA512:
6
- metadata.gz: bdbeb96ba139fe45e9fdf2f75a4c1fbf800d475d86344ec125318a2bba1f2e7e746a22271b7b6c2c02e6118077e920826999bb3f8e1bf282bb8a7dd8976e6f2b
7
- data.tar.gz: 5d02f02ea8ed31ca647809539531aa7b9793702dcfeb04d6dd2ccc238467a22a53a935931a89ab0e01241c331543705dbe8ffb415f3fe2634bf54ed693152e32
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
- Google::Cloud::Translate::V2.new project_id: project_id,
99
- credentials: credentials,
100
- key: key,
101
- scope: scope,
102
- retries: retries,
103
- timeout: timeout,
104
- endpoint: endpoint
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
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module Translate
23
- VERSION = "3.10.0"
23
+ VERSION = "3.10.1"
24
24
  end
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC