google-cloud-translate 3.6.1 → 3.7.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: ebf3eea7391fdec8069cfb01c1571c7fc098bf4b68921c3c28620c259e99c4db
4
- data.tar.gz: 2adc1170b4890a55ae857f1cbe44e4f7bdb6c75c7cde4fed38b9c4c14421be87
3
+ metadata.gz: 8c3463fd824093e2011f60d1e58a2e25f36d4db3924f39b755a21a2a76025d65
4
+ data.tar.gz: 37bc27caa04297682169e98980d3d2e4d74379c6d3f7a1a66f4181b0e62a4e76
5
5
  SHA512:
6
- metadata.gz: 0d0d8da4e740c86491b3da8a0fe6def9ccc1e556b6669a0a97d07a9d2b6a7b96a44ee9f8cd2ee59cbd488b0fe434325af162892cf944107577c81eb6f0641ba4
7
- data.tar.gz: b6957f48d457ac20d1b872c3ece082e3d2cbdf8b43e21d54d1a90d0e03be1e64a3ebe91cdf61eddbe4755bf1e94f45386f96bc85ed4e78a30b4228e5401ec241
6
+ metadata.gz: bd4a7e5175e186d9ec43eb2e642c728d5e89fc2b011eac330b0e3b77fc294cab8003cda564dc1946609c46b6a705a93698697b0b267e3955b10f359482bf06ea
7
+ data.tar.gz: cee5a8cf9756599246d510a052328430844fd52912dfe0548849db1bf010ac7c8a16789c1bb20d7f961cbf05e94fdb21c4f3bbc0a60b57ebc9120691f83ad2d8
data/README.md CHANGED
@@ -43,9 +43,40 @@ and includes substantial interface changes. Existing code written for earlier
43
43
  versions of this library will likely require updates to use this version.
44
44
  See the {file:MIGRATING.md MIGRATING.md} document for more information.
45
45
 
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ Debug logging also requires that the versioned clients for this service be
72
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
73
+ working, try updating the versioned clients in your bundle or installed gems:
74
+ [google-cloud-translate-v2](https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v2/latest),
75
+ [google-cloud-translate-v3](https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest).
76
+
46
77
  ## Supported Ruby Versions
47
78
 
48
- This library is supported on Ruby 2.7+.
79
+ This library is supported on Ruby 3.0+.
49
80
 
50
81
  Google provides official support for Ruby versions that are actively supported
51
82
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module Translate
23
- VERSION = "3.6.1"
23
+ VERSION = "3.7.0"
24
24
  end
25
25
  end
26
26
  end
@@ -58,6 +58,11 @@ module Google
58
58
  # You can also specify a different transport by passing `:rest` or `:grpc` in
59
59
  # the `transport` parameter.
60
60
  #
61
+ # Raises an exception if the currently installed versioned client gem for the
62
+ # given API version does not support the given transport of the TranslationService service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::Translate.translation_service_available?}.
65
+ #
61
66
  # ## About TranslationService
62
67
  #
63
68
  # Provides natural language translation operations.
@@ -79,6 +84,37 @@ module Google
79
84
  service_module.const_get(:Client).new(&block)
80
85
  end
81
86
 
87
+ ##
88
+ # Determines whether the TranslationService service is supported by the current client.
89
+ # If true, you can retrieve a client object by calling {Google::Cloud::Translate.translation_service}.
90
+ # If false, that method will raise an exception. This could happen if the given
91
+ # API version does not exist or does not support the TranslationService service,
92
+ # or if the versioned client gem needs an update to support the TranslationService service.
93
+ #
94
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
95
+ # Defaults to `:v3`.
96
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
97
+ # @return [boolean] Whether the service is available.
98
+ #
99
+ def self.translation_service_available? version: :v3, transport: :grpc
100
+ require "google/cloud/translate/#{version.to_s.downcase}"
101
+ package_name = Google::Cloud::Translate
102
+ .constants
103
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
104
+ .first
105
+ return false unless package_name
106
+ service_module = Google::Cloud::Translate.const_get package_name
107
+ return false unless service_module.const_defined? :TranslationService
108
+ service_module = service_module.const_get :TranslationService
109
+ if transport == :rest
110
+ return false unless service_module.const_defined? :Rest
111
+ service_module = service_module.const_get :Rest
112
+ end
113
+ service_module.const_defined? :Client
114
+ rescue ::LoadError
115
+ false
116
+ end
117
+
82
118
  ##
83
119
  # Configure the google-cloud-translate library.
84
120
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-translate
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -85,7 +84,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
85
84
  licenses:
86
85
  - Apache-2.0
87
86
  metadata: {}
88
- post_install_message:
89
87
  rdoc_options: []
90
88
  require_paths:
91
89
  - lib
@@ -93,15 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
91
  requirements:
94
92
  - - ">="
95
93
  - !ruby/object:Gem::Version
96
- version: '2.7'
94
+ version: '3.0'
97
95
  required_rubygems_version: !ruby/object:Gem::Requirement
98
96
  requirements:
99
97
  - - ">="
100
98
  - !ruby/object:Gem::Version
101
99
  version: '0'
102
100
  requirements: []
103
- rubygems_version: 3.5.6
104
- signing_key:
101
+ rubygems_version: 3.6.2
105
102
  specification_version: 4
106
103
  summary: API Client library for the Cloud Translation API
107
104
  test_files: []