google-cloud-text_to_speech 1.7.1 → 2.0.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: f113e4d5686c0a10f1b746fea43d03837ce9742f123be71928a7d8174408d484
4
- data.tar.gz: 147e75662be1210071e97eb4959ea1b443b1888bfdd5ee6711965cea64cceb1f
3
+ metadata.gz: 1436519731d29f18659d9837cbdf11887f9b03b694d11421352553e5702dfa77
4
+ data.tar.gz: a4c6971d94a1a7ba0c7bb708b2647ed9bc3b6744cd3c2046c63394c9e33d5af2
5
5
  SHA512:
6
- metadata.gz: d67ee29e11ac27dd512c26f56df65c8c423a725b564f88418c0d928b77101a507cf70637b6b33f9189937aaab76a9b3f79f1fab749fdb895d37db7ca7a0dea0f
7
- data.tar.gz: 0d0e9c399db95cae7b037f93c8629be8a0ea39e26dc0928267359a5ffb02c9873dbf2738f36420c88b4c10c738ad26609f8a226ecca6085901e3321a07330315
6
+ metadata.gz: a8d42060ebf6e82cb317b6ea6b9d696b95402c73be7eceb7c7cc2124b1801abf53384949225e319ef3106140a77fa835f4082c9861efba46342720baa2623084
7
+ data.tar.gz: c1650f6d660b006b49a7f999d0d1843edfc602a0432cdb9e279f87113229dd0be96788be433d2c6dbb720bffecb625236aa8edca3651d4fd7bf393d13f63e1dd
data/.yardopts CHANGED
@@ -8,5 +8,4 @@
8
8
  -
9
9
  README.md
10
10
  AUTHENTICATION.md
11
- MIGRATING.md
12
11
  LICENSE.md
data/README.md CHANGED
@@ -16,8 +16,7 @@ for this library, google-cloud-text_to_speech, to see the convenience methods fo
16
16
  constructing client objects. Reference documentation for the client objects
17
17
  themselves can be found in the client library documentation for the versioned
18
18
  client gems:
19
- [google-cloud-text_to_speech-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1/latest),
20
- [google-cloud-text_to_speech-v1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1beta1/latest).
19
+ [google-cloud-text_to_speech-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1/latest).
21
20
 
22
21
  See also the [Product Documentation](https://cloud.google.com/text-to-speech)
23
22
  for more usage information.
@@ -35,17 +34,39 @@ In order to use this library, you first need to go through the following steps:
35
34
  1. [Enable the API.](https://console.cloud.google.com/apis/library/texttospeech.googleapis.com)
36
35
  1. {file:AUTHENTICATION.md Set up authentication.}
37
36
 
38
- ## Migrating from 0.x versions
39
-
40
- The 1.0 release of the google-cloud-text_to_speech client is a significant upgrade
41
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
42
- and includes substantial interface changes. Existing code written for earlier
43
- versions of this library will likely require updates to use this version.
44
- See the {file:MIGRATING.md MIGRATING.md} document for more information.
37
+ ## Debug Logging
38
+
39
+ This library comes with opt-in Debug Logging that can help you troubleshoot
40
+ your application's integration with the API. When logging is activated, key
41
+ events such as requests and responses, along with data payloads and metadata
42
+ such as headers and client configuration, are logged to the standard error
43
+ stream.
44
+
45
+ **WARNING:** Client Library Debug Logging includes your data payloads in
46
+ plaintext, which could include sensitive data such as PII for yourself or your
47
+ customers, private keys, or other security data that could be compromising if
48
+ leaked. Always practice good data hygiene with your application logs, and follow
49
+ the principle of least access. Google also recommends that Client Library Debug
50
+ Logging be enabled only temporarily during active debugging, and not used
51
+ permanently in production.
52
+
53
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
54
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
55
+ list of client library gem names. This will select the default logging behavior,
56
+ which writes logs to the standard error stream. On a local workstation, this may
57
+ result in logs appearing on the console. When running on a Google Cloud hosting
58
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
59
+ results in logs appearing alongside your application logs in the
60
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
61
+
62
+ Debug logging also requires that the versioned clients for this service be
63
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
64
+ working, try updating the versioned clients in your bundle or installed gems:
65
+ [google-cloud-text_to_speech-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-text_to_speech-v1/latest).
45
66
 
46
67
  ## Supported Ruby Versions
47
68
 
48
- This library is supported on Ruby 2.7+.
69
+ This library is supported on Ruby 3.0+.
49
70
 
50
71
  Google provides official support for Ruby versions that are actively supported
51
72
  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 TextToSpeech
23
- VERSION = "1.7.1"
23
+ VERSION = "2.0.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 TextToSpeech service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::TextToSpeech.text_to_speech_available?}.
65
+ #
61
66
  # ## About TextToSpeech
62
67
  #
63
68
  # Service that implements Google Cloud Text-to-Speech API.
@@ -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 TextToSpeech service is supported by the current client.
89
+ # If true, you can retrieve a client object by calling {Google::Cloud::TextToSpeech.text_to_speech}.
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 TextToSpeech service,
92
+ # or if the versioned client gem needs an update to support the TextToSpeech service.
93
+ #
94
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
95
+ # Defaults to `:v1`.
96
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
97
+ # @return [boolean] Whether the service is available.
98
+ #
99
+ def self.text_to_speech_available? version: :v1, transport: :grpc
100
+ require "google/cloud/text_to_speech/#{version.to_s.downcase}"
101
+ package_name = Google::Cloud::TextToSpeech
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::TextToSpeech.const_get package_name
107
+ return false unless service_module.const_defined? :TextToSpeech
108
+ service_module = service_module.const_get :TextToSpeech
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
  # Create a new client object for TextToSpeechLongAudioSynthesize.
84
120
  #
@@ -92,6 +128,11 @@ module Google
92
128
  # You can also specify a different transport by passing `:rest` or `:grpc` in
93
129
  # the `transport` parameter.
94
130
  #
131
+ # Raises an exception if the currently installed versioned client gem for the
132
+ # given API version does not support the given transport of the TextToSpeechLongAudioSynthesize service.
133
+ # You can determine whether the method will succeed by calling
134
+ # {Google::Cloud::TextToSpeech.text_to_speech_long_audio_synthesize_available?}.
135
+ #
95
136
  # ## About TextToSpeechLongAudioSynthesize
96
137
  #
97
138
  # Service that implements Google Cloud Text-to-Speech API.
@@ -113,6 +154,37 @@ module Google
113
154
  service_module.const_get(:Client).new(&block)
114
155
  end
115
156
 
157
+ ##
158
+ # Determines whether the TextToSpeechLongAudioSynthesize service is supported by the current client.
159
+ # If true, you can retrieve a client object by calling {Google::Cloud::TextToSpeech.text_to_speech_long_audio_synthesize}.
160
+ # If false, that method will raise an exception. This could happen if the given
161
+ # API version does not exist or does not support the TextToSpeechLongAudioSynthesize service,
162
+ # or if the versioned client gem needs an update to support the TextToSpeechLongAudioSynthesize service.
163
+ #
164
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
165
+ # Defaults to `:v1`.
166
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
167
+ # @return [boolean] Whether the service is available.
168
+ #
169
+ def self.text_to_speech_long_audio_synthesize_available? version: :v1, transport: :grpc
170
+ require "google/cloud/text_to_speech/#{version.to_s.downcase}"
171
+ package_name = Google::Cloud::TextToSpeech
172
+ .constants
173
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
174
+ .first
175
+ return false unless package_name
176
+ service_module = Google::Cloud::TextToSpeech.const_get package_name
177
+ return false unless service_module.const_defined? :TextToSpeechLongAudioSynthesize
178
+ service_module = service_module.const_get :TextToSpeechLongAudioSynthesize
179
+ if transport == :rest
180
+ return false unless service_module.const_defined? :Rest
181
+ service_module = service_module.const_get :Rest
182
+ end
183
+ service_module.const_defined? :Client
184
+ rescue ::LoadError
185
+ false
186
+ end
187
+
116
188
  ##
117
189
  # Configure the google-cloud-text_to_speech library.
118
190
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-text_to_speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 2.0.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-02-13 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -28,42 +27,16 @@ dependencies:
28
27
  name: google-cloud-text_to_speech-v1
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0.12'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 2.a
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '0.12'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 2.a
47
- - !ruby/object:Gem::Dependency
48
- name: google-cloud-text_to_speech-v1beta1
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0.13'
54
- - - "<"
30
+ - - "~>"
55
31
  - !ruby/object:Gem::Version
56
- version: 2.a
32
+ version: '1.7'
57
33
  type: :runtime
58
34
  prerelease: false
59
35
  version_requirements: !ruby/object:Gem::Requirement
60
36
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0.13'
64
- - - "<"
37
+ - - "~>"
65
38
  - !ruby/object:Gem::Version
66
- version: 2.a
39
+ version: '1.7'
67
40
  description: Text-to-Speech converts text or Speech Synthesis Markup Language (SSML)
68
41
  input into audio data of natural human speech.
69
42
  email: googleapis-packages@google.com
@@ -74,7 +47,6 @@ files:
74
47
  - ".yardopts"
75
48
  - AUTHENTICATION.md
76
49
  - LICENSE.md
77
- - MIGRATING.md
78
50
  - README.md
79
51
  - lib/google-cloud-text_to_speech.rb
80
52
  - lib/google/cloud/text_to_speech.rb
@@ -83,7 +55,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
83
55
  licenses:
84
56
  - Apache-2.0
85
57
  metadata: {}
86
- post_install_message:
87
58
  rdoc_options: []
88
59
  require_paths:
89
60
  - lib
@@ -91,15 +62,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
62
  requirements:
92
63
  - - ">="
93
64
  - !ruby/object:Gem::Version
94
- version: '2.7'
65
+ version: '3.0'
95
66
  required_rubygems_version: !ruby/object:Gem::Requirement
96
67
  requirements:
97
68
  - - ">="
98
69
  - !ruby/object:Gem::Version
99
70
  version: '0'
100
71
  requirements: []
101
- rubygems_version: 3.5.6
102
- signing_key:
72
+ rubygems_version: 3.6.3
103
73
  specification_version: 4
104
74
  summary: API Client library for the Cloud Text-to-Speech API
105
75
  test_files: []
data/MIGRATING.md DELETED
@@ -1,281 +0,0 @@
1
- ## Migrating to google-cloud-text_to_speech 1.0
2
-
3
- The 1.0 release of the google-cloud-text_to_speech client is a significant upgrade
4
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
5
- and includes substantial interface changes. Existing code written for earlier
6
- versions of this library will likely require updates to use this version.
7
- This document describes the changes that have been made, and what you need to
8
- do to update your usage.
9
-
10
- To summarize:
11
-
12
- * The library has been broken out into three libraries. The new gems
13
- `google-cloud-text_to_speech-v1` and `google-cloud-text_to_speech-v1beta1` contain the
14
- actual client classes for versions V1 and V1beta1 of the Text To Speech
15
- service, and the gem `google-cloud-text_to_speech` now simply provides a
16
- convenience wrapper. See [Library Structure](#library-structure) for more
17
- info.
18
- * The library uses a new configuration mechanism giving you closer control
19
- over endpoint address, network timeouts, and retry. See
20
- [Client Configuration](#client-configuration) for more info. Furthermore,
21
- when creating a client object, you can customize its configuration in a
22
- block rather than passing arguments to the constructor. See
23
- [Creating Clients](#creating-clients) for more info.
24
- * Previously, positional arguments were used to indicate required arguments.
25
- Now, all method arguments are keyword arguments, with documentation that
26
- specifies whether they are required or optional. Additionally, you can pass
27
- a proto request object instead of separate arguments. See
28
- [Passing Arguments](#passing-arguments) for more info.
29
- * Previously, clients reported RPC errors by raising instances of
30
- `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
31
- `Google::Cloud::Error` and its subclasses. See
32
- [Handling Errors](#handling-errors) for more info.
33
- * Some classes have moved into different namespaces. See
34
- [Class Namespaces](#class-namespaces) for more info.
35
-
36
- ### Library Structure
37
-
38
- Older 0.x releases of the `google-cloud-text_to_speech` gem were all-in-one gems that
39
- included potentially multiple clients for multiple versions of the Text To
40
- Speech service. The `Google::Cloud::TextToSpeech.new` factory method would
41
- return you an instance of a `Google::Cloud::TextToSpeech::V1::TextToSpeechClient`
42
- object for the V1 version of the service, or a
43
- `Google::Cloud::TextToSpeech::V1beta1::TextToSpeechClient` object for the
44
- V1beta1 version of the service. All these classes were defined in the same gem.
45
-
46
- With the 1.0 release, the `google-cloud-text_to_speech` gem still provides factory
47
- methods for obtaining clients. (The method signatures will have changed. See
48
- [Creating Clients](#creating-clients) for details.) However, the actual client
49
- classes have been moved into separate gems, one per service version. The
50
- `Google::Cloud::TextToSpeech::V1::TextToSpeech::Client` class, along with its
51
- helpers and data types, is now part of the `google-cloud-text_to_speech-v1` gem.
52
- Similarly, the `Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client`
53
- class is part of the `google-cloud-text_to_speech-v1beta1` gem.
54
-
55
- For normal usage, you can continue to install the `google-cloud-text_to_speech` gem
56
- (which will bring in the versioned client gems as dependencies) and continue to
57
- use factory methods to create clients. However, you may alternatively choose to
58
- install only one of the versioned gems. For example, if you know you will use only
59
- `V1` of the service, you can install `google-cloud-text_to_speech-v1` by itself, and
60
- construct instances of the
61
- `Google::Cloud::TextToSpeech::V1::TextToSpeech::Client` client class directly.
62
-
63
- ### Client Configuration
64
-
65
- In older releases, if you wanted to customize performance parameters or
66
- low-level behavior of the client (such as credentials, timeouts, or
67
- instrumentation), you would pass a variety of keyword arguments to the client
68
- constructor. It was also extremely difficult to customize the default settings.
69
-
70
- With the 1.0 release, a configuration interface provides control over these
71
- parameters, including defaults for all instances of a client, and settings for
72
- each specific client instance. For example, to set default credentials and
73
- timeout for all Text To Speech V1 clients:
74
-
75
- ```
76
- Google::Cloud::TextToSpeech::V1::TextToSpeech::Client.configure do |config|
77
- config.credentials = "/path/to/credentials.json"
78
- config.timeout = 10.0
79
- end
80
- ```
81
-
82
- Individual RPCs can also be configured independently. For example, to set the
83
- timeout for the `list_voices` call:
84
-
85
- ```
86
- Google::Cloud::TextToSpeech::V1::TextToSpeech::Client.configure do |config|
87
- config.rpcs.list_voices.timeout = 20.0
88
- end
89
- ```
90
-
91
- Defaults for certain configurations can be set for all Text To Speech versions
92
- globally:
93
-
94
- ```
95
- Google::Cloud::TextToSpeech.configure do |config|
96
- config.credentials = "/path/to/credentials.json"
97
- config.timeout = 10.0
98
- end
99
- ```
100
-
101
- Finally, you can override the configuration for each client instance. See the
102
- next section on [Creating Clients](#creating-clients) for details.
103
-
104
- ### Creating Clients
105
-
106
- In older releases, to create a client object, you would use the
107
- `Google::Cloud::TextToSpeech.new` class method. Keyword arguments were available to
108
- select a service version and to configure parameters such as credentials and
109
- timeouts.
110
-
111
- With the 1.0 release, use the `Google::Cloud::TextToSpeech.text_to_speech` class
112
- method to create a client object. You may select a service version using the
113
- `:version` keyword argument. However, other configuration parameters should be
114
- set in a configuration block when you create the client.
115
-
116
- Old:
117
- ```
118
- client = Google::Cloud::TextToSpeech.new credentials: "/path/to/credentials.json"
119
- ```
120
-
121
- New:
122
- ```
123
- client = Google::Cloud::TextToSpeech.text_to_speech do |config|
124
- config.credentials = "/path/to/credentials.json"
125
- end
126
- ```
127
-
128
- The configuration block is optional. If you do not provide it, or you do not
129
- set some configuration parameters, then the default configuration is used. See
130
- [Client Configuration](#client-configuration).
131
-
132
- ### Passing Arguments
133
-
134
- In older releases, required arguments would be passed as positional method
135
- arguments, while most optional arguments would be passed as keyword arguments.
136
-
137
- With the 1.0 release, all RPC arguments are passed as keyword arguments,
138
- regardless of whether they are required or optional. For example:
139
-
140
- Old:
141
- ```
142
- client = Google::Cloud::TextToSpeech.new
143
-
144
- input = { text: "Hello, world!" }
145
- voice = { language_code: "en-US" }
146
- audio = { audio_encoding: Google::Cloud::Texttospeech::V1::AudioEncoding::MP3 }
147
-
148
- # The three arguments are all positional.
149
- response = client.synthesize_speech input, voice, audio
150
- ```
151
-
152
- New:
153
- ```
154
- client = Google::Cloud::TextToSpeech.text_to_speech
155
-
156
- input = { text: "Hello, world!" }
157
- voice = { language_code: "en-US" }
158
- audio = { audio_encoding: Google::Cloud::TextToSpeech::V1::AudioEncoding::MP3 }
159
-
160
- # The three arguments are all keyword arguments.
161
- response = client.synthesize_speech input: input, voice: voice, audio_config: audio
162
- ```
163
-
164
- In the 1.0 release, it is also possible to pass a request object, either
165
- as a hash or as a protocol buffer.
166
-
167
- New:
168
- ```
169
- client = Google::Cloud::TextToSpeech.text_to_speech
170
-
171
- request = Google::Cloud::TextToSpeech::V1::SynthesizeSpeechRequest.new(
172
- input: { text: "Hello, world!" },
173
- voice: { language_code: "en-US" },
174
- audio: { audio_encoding: Google::Cloud::TextToSpeech::V1::AudioEncoding::MP3 }
175
- )
176
-
177
- # Pass a request object as a positional argument:
178
- response = client.synthesize_speech request
179
- ```
180
-
181
- Finally, in older releases, to provide call options, you would pass a
182
- `Google::Gax::CallOptions` object with the `:options` keyword argument. In the
183
- 1.0 release, pass call options using a _second set_ of keyword arguments.
184
-
185
- Old:
186
- ```
187
- client = Google::Cloud::TextToSpeech.new
188
-
189
- input = { text: "Hello, world!" }
190
- voice = { language_code: "en-US" }
191
- audio = { audio_encoding: Google::Cloud::TextToSpeech::V1::AudioEncoding::MP3 }
192
-
193
- options = Google::Gax::CallOptions.new timeout: 10.0
194
-
195
- response = client.synthesize_speech input, voice, audio, options: options
196
- ```
197
-
198
- New:
199
- ```
200
- client = Google::Cloud::TextToSpeech.text_to_speech
201
-
202
- input = { text: "Hello, world!" }
203
- voice = { language_code: "en-US" }
204
- audio = { audio_encoding: Google::Cloud::TextToSpeech::V1::AudioEncoding::MP3 }
205
-
206
- # Use a hash to wrap the normal call arguments (or pass a request object), and
207
- # then add further keyword arguments for the call options.
208
- response = client.synthesize_speech(
209
- { input: input, voice: voice, audio_config: audio },
210
- timeout: 10.0
211
- )
212
- ```
213
-
214
- ### Handling Errors
215
-
216
- The client reports standard
217
- [gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
218
- by raising exceptions. In older releases, these exceptions were located in the
219
- `Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
220
- exception class, defined in the `google-gax` gem. However, these classes were
221
- different from the standard exceptions (subclasses of `Google::Cloud::Error`)
222
- thrown by other client libraries such as `google-cloud-storage`.
223
-
224
- The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
225
- for consistency across all the Google Cloud client libraries. In general, these
226
- exceptions have the same name as their counterparts from older releases, but
227
- are located in the `Google::Cloud` namespace rather than the `Google::Gax`
228
- namespace.
229
-
230
- Old:
231
- ```
232
- client = Google::Cloud::TextToSpeech.new
233
-
234
- input = { text: "Hello, world!" }
235
- voice = { language_code: "en-US" }
236
- audio = { audio_encoding: Google::Cloud::Texttospeech::V1::AudioEncoding::MP3 }
237
-
238
- begin
239
- response = client.synthesize_speech input, voice, audio
240
- rescue Google::Gax::Error => e
241
- # Handle exceptions that subclass Google::Gax::Error
242
- end
243
- ```
244
-
245
- New:
246
- ```
247
- client = Google::Cloud::TextToSpeech.text_to_speech
248
-
249
- input = { text: "Hello, world!" }
250
- voice = { language_code: "en-US" }
251
- audio = { audio_encoding: Google::Cloud::TextToSpeech::V1::AudioEncoding::MP3 }
252
-
253
- begin
254
- response = client.synthesize_speech input: input, voice: voice,
255
- audio_config: audio
256
- rescue Google::Cloud::Error => e
257
- # Handle exceptions that subclass Google::Cloud::Error
258
- end
259
- ```
260
-
261
- ### Class Namespaces
262
-
263
- In older releases, some data type (protobuf) classes were located under the module
264
- `Google::Cloud::Texttospeech`. In the 1.0 release, these classes have been moved into the
265
- same `Google::Cloud::TextToSpeech` module by the client object, for consistency.
266
-
267
- In older releases, the client object was of class
268
- `Google::Cloud::TextToSpeech::V1::TextToSpeechClient`.
269
- In the 1.0 release, the client object is of class
270
- `Google::Cloud::TextToSpeech::V1::TextToSpeech::Client`.
271
- Note that most users will use the `Google::Cloud::TextToSpeech.text_to_speech`
272
- factory method to create instances of the client object, so you may not need to
273
- reference the actual class directly.
274
- See [Creating Clients](#creating-clients).
275
-
276
- In older releases, the credentials object was of class
277
- `Google::Cloud::TextToSpeech::V1::Credentials`.
278
- In the 1.0 release, the credentials object is of class
279
- `Google::Cloud::TextToSpeech::V1::TextToSpeech::Credentials`.
280
- Again, most users will not need to reference this class directly.
281
- See [Client Configuration](#client-configuration).