google-cloud-speech 0.26.2 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 13a82226f14d77db107909738ad30aa39cc73f88
4
- data.tar.gz: b2b830a2f48d2a28e1fef512c33b87d6dfe8a722
2
+ SHA256:
3
+ metadata.gz: c32f349bd2b6cc7d6c38dd586be1cda6323389bc9f8b79003e5f69b3527df864
4
+ data.tar.gz: da3c6318e1fe70438e40504e44736709cb84b2bc779efc41aefcd90fa53d274f
5
5
  SHA512:
6
- metadata.gz: ad66452799bbd812278d4d201c4c2f94acda4be720f86e71aa6d84c3d6769049ea674c76f8dd80994c9f1989a47820fc491dfece6a73d3a4acb1d0223cf9f037
7
- data.tar.gz: 625b298a86af9eb06d22e7094357a961ca85a76857b7a75cc320e61544233a53dd1308623734e2d07d7c2cb7440218c0ab5dc96707014cca2ce86b0b2eba8497
6
+ metadata.gz: 399fd1bbc46575e23f5876aab2e9b01971fee595ffdd6c74572900137615c17b3aaf7f51edeaf4f11d4563367863ba6e5faee97f6a0b43b3e990867b7f1db628
7
+ data.tar.gz: 6e9f031f86bcbcf2e7801bb1c27c9c676c930a212b20f2e0bc0376a1304f0fa722ba012654228340a43102f207eaeb4bbf2ca2d3d2085b8fb345119434ffdd81
@@ -13,9 +13,9 @@
13
13
  # limitations under the License.
14
14
 
15
15
  ##
16
- # This file is here to be autorequired by bundler, so that the .speech and
17
- # #speech methods can be available, but the library and all dependencies won't
18
- # be loaded until required and used.
16
+ # This file is here to be autorequired by bundler, so that the
17
+ # Google::Cloud.speech and Google::Cloud#speech methods can be available, but
18
+ # the library and all dependencies won't be loaded until required and used.
19
19
 
20
20
 
21
21
  gem "google-cloud-core"
@@ -75,10 +75,12 @@ module Google
75
75
  # For more information on connecting to Google Cloud see the [Authentication
76
76
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
77
77
  #
78
- # @param [String] project Project identifier for the Speech service you are
79
- # connecting to.
80
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
81
- # file path the file must be readable.
78
+ # @param [String] project_id Project identifier for the Speech service
79
+ # you are connecting to. If not present, the default project for the
80
+ # credentials is used.
81
+ # @param [String, Hash, Google::Auth::Credentials] credentials The path to
82
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
83
+ # Google::Auth::Credentials object. (See {Speech::Credentials})
82
84
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the
83
85
  # set of resources and operations that the connection can access. See
84
86
  # [Using OAuth 2.0 to Access Google
@@ -103,10 +105,11 @@ module Google
103
105
  # language: "en-US",
104
106
  # sample_rate: 16000
105
107
  #
106
- def self.speech project = nil, keyfile = nil, scope: nil, timeout: nil,
107
- client_config: nil
108
+ def self.speech project_id = nil, credentials = nil, scope: nil,
109
+ timeout: nil, client_config: nil
108
110
  require "google/cloud/speech"
109
- Google::Cloud::Speech.new project: project, keyfile: keyfile,
111
+ Google::Cloud::Speech.new project_id: project_id,
112
+ credentials: credentials,
110
113
  scope: scope, timeout: timeout,
111
114
  client_config: client_config
112
115
  end
@@ -189,10 +189,12 @@ module Google
189
189
  # [Authentication
190
190
  # Guide](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
191
191
  #
192
- # @param [String] project Project identifier for the Speech service you
193
- # are connecting to.
194
- # @param [String, Hash] keyfile Keyfile downloaded from Google Cloud. If
195
- # file path the file must be readable.
192
+ # @param [String] project_id Project identifier for the Speech service
193
+ # you are connecting to. If not present, the default project for the
194
+ # credentials is used.
195
+ # @param [String, Hash, Google::Auth::Credentials] credentials The path to
196
+ # the keyfile as a String, the contents of the keyfile as a Hash, or a
197
+ # Google::Auth::Credentials object. (See {Speech::Credentials})
196
198
  # @param [String, Array<String>] scope The OAuth 2.0 scopes controlling
197
199
  # the set of resources and operations that the connection can access.
198
200
  # See [Using OAuth 2.0 to Access Google
@@ -204,6 +206,9 @@ module Google
204
206
  # @param [Integer] timeout Default timeout to use in requests. Optional.
205
207
  # @param [Hash] client_config A hash of values to override the default
206
208
  # behavior of the API client. Optional.
209
+ # @param [String] project Alias for the `project_id` argument. Deprecated.
210
+ # @param [String] keyfile Alias for the `credentials` argument.
211
+ # Deprecated.
207
212
  #
208
213
  # @return [Google::Cloud::Speech::Project]
209
214
  #
@@ -217,23 +222,21 @@ module Google
217
222
  # language: "en-US",
218
223
  # sample_rate: 16000
219
224
  #
220
- def self.new project: nil, keyfile: nil, scope: nil, timeout: nil,
221
- client_config: nil
222
- project ||= Google::Cloud::Speech::Project.default_project
223
- project = project.to_s # Always cast to a string
224
- fail ArgumentError, "project is missing" if project.empty?
225
+ def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
226
+ client_config: nil, project: nil, keyfile: nil
227
+ project_id ||= (project || Speech::Project.default_project_id)
228
+ project_id = project_id.to_s # Always cast to a string
229
+ fail ArgumentError, "project_id is missing" if project_id.empty?
225
230
 
226
- if keyfile.nil?
227
- credentials = Google::Cloud::Speech::Credentials.default scope: scope
228
- else
229
- credentials = Google::Cloud::Speech::Credentials.new(
230
- keyfile, scope: scope)
231
+ credentials ||= (keyfile || Speech::Credentials.default(scope: scope))
232
+ unless credentials.is_a? Google::Auth::Credentials
233
+ credentials = Speech::Credentials.new credentials, scope: scope
231
234
  end
232
235
 
233
- Google::Cloud::Speech::Project.new(
234
- Google::Cloud::Speech::Service.new(
235
- project, credentials, timeout: timeout,
236
- client_config: client_config))
236
+ Speech::Project.new(
237
+ Speech::Service.new(
238
+ project_id, credentials, timeout: timeout,
239
+ client_config: client_config))
237
240
  end
238
241
  end
239
242
  end
@@ -13,19 +13,44 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/credentials"
17
- require "google/cloud/speech/v1"
16
+ require "googleauth"
18
17
 
19
18
  module Google
20
19
  module Cloud
21
20
  module Speech
22
21
  ##
23
- # @private Represents the OAuth 2.0 signing logic for Speech.
24
- class Credentials < Google::Cloud::Credentials
25
- SCOPE = V1::SpeechClient::ALL_SCOPES
26
- PATH_ENV_VARS = %w(SPEECH_KEYFILE GOOGLE_CLOUD_KEYFILE GCLOUD_KEYFILE)
27
- JSON_ENV_VARS = %w(SPEECH_KEYFILE_JSON GOOGLE_CLOUD_KEYFILE_JSON
22
+ # # Credentials
23
+ #
24
+ # Represents the authentication and authorization used to connect to the
25
+ # Speech API.
26
+ #
27
+ # @example
28
+ # require "google/cloud/speech"
29
+ #
30
+ # keyfile = "/path/to/keyfile.json"
31
+ # creds = Google::Cloud::Speech::Credentials.new keyfile
32
+ #
33
+ # speech = Google::Cloud::Speech.new(
34
+ # project_id: "my-project",
35
+ # credentials: creds
36
+ # )
37
+ #
38
+ # speech.project_id #=> "my-project"
39
+ #
40
+ class Credentials < Google::Auth::Credentials
41
+ SCOPE = ["https://www.googleapis.com/auth/cloud-platform"]
42
+ PATH_ENV_VARS = %w(SPEECH_CREDENTIALS
43
+ SPEECH_KEYFILE
44
+ GOOGLE_CLOUD_CREDENTIALS
45
+ GOOGLE_CLOUD_KEYFILE
46
+ GCLOUD_KEYFILE)
47
+ JSON_ENV_VARS = %w(SPEECH_CREDENTIALS_JSON
48
+ SPEECH_KEYFILE_JSON
49
+ GOOGLE_CLOUD_CREDENTIALS_JSON
50
+ GOOGLE_CLOUD_KEYFILE_JSON
28
51
  GCLOUD_KEYFILE_JSON)
52
+ DEFAULT_PATHS = \
53
+ ["~/.config/gcloud/application_default_credentials.json"]
29
54
  end
30
55
  end
31
56
  end
@@ -70,19 +70,20 @@ module Google
70
70
  # require "google/cloud/speech"
71
71
  #
72
72
  # speech = Google::Cloud::Speech.new(
73
- # project: "my-project-id",
74
- # keyfile: "/path/to/keyfile.json"
73
+ # project_id: "my-project",
74
+ # credentials: "/path/to/keyfile.json"
75
75
  # )
76
76
  #
77
- # speech.project #=> "my-project-id"
77
+ # speech.project_id #=> "my-project"
78
78
  #
79
- def project
79
+ def project_id
80
80
  service.project
81
81
  end
82
+ alias_method :project, :project_id
82
83
 
83
84
  ##
84
85
  # @private Default project.
85
- def self.default_project
86
+ def self.default_project_id
86
87
  ENV["SPEECH_PROJECT"] ||
87
88
  ENV["GOOGLE_CLOUD_PROJECT"] ||
88
89
  ENV["GCLOUD_PROJECT"] ||
@@ -25,37 +25,22 @@ module Google
25
25
  # @private Represents the gRPC Speech service, including all the API
26
26
  # methods.
27
27
  class Service
28
- attr_accessor :project, :credentials, :host, :timeout, :client_config
28
+ attr_accessor :project, :credentials, :timeout, :client_config
29
29
 
30
30
  ##
31
31
  # Creates a new Service instance.
32
- def initialize project, credentials, host: nil, timeout: nil,
33
- client_config: nil
32
+ def initialize project, credentials, timeout: nil, client_config: nil
34
33
  @project = project
35
34
  @credentials = credentials
36
- @host = host || V1::SpeechClient::SERVICE_ADDRESS
37
35
  @timeout = timeout
38
36
  @client_config = client_config || {}
39
37
  end
40
38
 
41
- def channel
42
- require "grpc"
43
- GRPC::Core::Channel.new host, nil, chan_creds
44
- end
45
-
46
- def chan_creds
47
- return credentials if insecure?
48
- require "grpc"
49
- GRPC::Core::ChannelCredentials.new.compose \
50
- GRPC::Core::CallCredentials.new credentials.client.updater_proc
51
- end
52
-
53
39
  def service
54
40
  return mocked_service if mocked_service
55
41
  @service ||= \
56
42
  V1::SpeechClient.new(
57
- service_path: host,
58
- channel: channel,
43
+ credentials: credentials,
59
44
  timeout: timeout,
60
45
  client_config: client_config,
61
46
  lib_name: "gccl",
@@ -67,8 +52,8 @@ module Google
67
52
  return mocked_ops if mocked_ops
68
53
  @ops ||= \
69
54
  Google::Longrunning::OperationsClient.new(
70
- service_path: host,
71
- channel: channel,
55
+ service_path: V1::SpeechClient::SERVICE_ADDRESS,
56
+ credentials: credentials,
72
57
  timeout: timeout,
73
58
  client_config: client_config,
74
59
  lib_name: "gccl",
@@ -76,10 +61,6 @@ module Google
76
61
  end
77
62
  attr_accessor :mocked_ops
78
63
 
79
- def insecure?
80
- credentials == :this_channel_is_insecure
81
- end
82
-
83
64
  def recognize_sync audio, config
84
65
  execute do
85
66
  service.recognize config, audio, options: default_options
@@ -15,6 +15,17 @@
15
15
  module Google
16
16
  module Cloud
17
17
  module Speech
18
+ ##
19
+ # # Google Cloud Speech API Contents
20
+ #
21
+ # | Class | Description |
22
+ # | ----- | ----------- |
23
+ # | [SpeechClient][] | Google Cloud Speech API. |
24
+ # | [Data Types][] | Data types for Google::Cloud::Speech::V1 |
25
+ #
26
+ # [SpeechClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1/speechclient
27
+ # [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-speech/latest/google/cloud/speech/v1/datatypes
28
+ #
18
29
  module V1
19
30
  # The top-level message sent by the client for the +Recognize+ method.
20
31
  # @!attribute [rw] config
@@ -252,8 +263,10 @@ module Google
252
263
  class LongRunningRecognizeMetadata; end
253
264
 
254
265
  # +StreamingRecognizeResponse+ is the only message returned to the client by
255
- # +StreamingRecognize+. A series of one or more +StreamingRecognizeResponse+
256
- # messages are streamed back to the client.
266
+ # +StreamingRecognize+. A series of zero or more +StreamingRecognizeResponse+
267
+ # messages are streamed back to the client. If there is no recognizable
268
+ # audio, and +single_utterance+ is set to false, then no messages are streamed
269
+ # back to the client.
257
270
  #
258
271
  # Here's an example of a series of ten +StreamingRecognizeResponse+s that might
259
272
  # be returned while processing audio:
@@ -306,8 +319,8 @@ module Google
306
319
  # @return [Array<Google::Cloud::Speech::V1::StreamingRecognitionResult>]
307
320
  # *Output-only* This repeated list contains zero or more results that
308
321
  # correspond to consecutive portions of the audio currently being processed.
309
- # It contains zero or one +is_final=true+ result (the newly settled portion),
310
- # followed by zero or more +is_final=false+ results.
322
+ # It contains zero or more +is_final=false+ results followed by zero or one
323
+ # +is_final=true+ result (the newly settled portion).
311
324
  # @!attribute [rw] speech_event_type
312
325
  # @return [Google::Cloud::Speech::V1::StreamingRecognizeResponse::SpeechEventType]
313
326
  # *Output-only* Indicates the type of speech event.
@@ -49,6 +49,16 @@ module Google
49
49
  # any.Unpack(foo)
50
50
  # ...
51
51
  #
52
+ # Example 4: Pack and unpack a message in Go
53
+ #
54
+ # foo := &pb.Foo{...}
55
+ # any, err := ptypes.MarshalAny(foo)
56
+ # ...
57
+ # foo := &pb.Foo{}
58
+ # if err := ptypes.UnmarshalAny(any, foo); err != nil {
59
+ # ...
60
+ # }
61
+ #
52
62
  # The pack methods provided by protobuf library will by default use
53
63
  # 'type.googleapis.com/full.type.name' as the type URL and the unpack
54
64
  # methods only use the fully qualified type name after the last '/'
@@ -21,6 +21,8 @@ module Google
21
21
  # two Timestamp values is a Duration and it can be added or subtracted
22
22
  # from a Timestamp. Range is approximately +-10,000 years.
23
23
  #
24
+ # = Examples
25
+ #
24
26
  # Example 1: Compute Duration from two Timestamps in pseudo code.
25
27
  #
26
28
  # Timestamp start = ...;
@@ -60,10 +62,21 @@ module Google
60
62
  # td = datetime.timedelta(days=3, minutes=10)
61
63
  # duration = Duration()
62
64
  # duration.FromTimedelta(td)
65
+ #
66
+ # = JSON Mapping
67
+ #
68
+ # In JSON format, the Duration type is encoded as a string rather than an
69
+ # object, where the string ends in the suffix "s" (indicating seconds) and
70
+ # is preceded by the number of seconds, with nanoseconds expressed as
71
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
72
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
73
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
74
+ # microsecond should be expressed in JSON format as "3.000001s".
63
75
  # @!attribute [rw] seconds
64
76
  # @return [Integer]
65
77
  # Signed seconds of the span of time. Must be from -315,576,000,000
66
- # to +315,576,000,000 inclusive.
78
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
79
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
67
80
  # @!attribute [rw] nanos
68
81
  # @return [Integer]
69
82
  # Signed fractions of a second at nanosecond resolution of the span
@@ -31,7 +31,7 @@ module Google
31
31
  # error message is needed, put the localized message in the error details or
32
32
  # localize it in the client. The optional error details may contain arbitrary
33
33
  # information about the error. There is a predefined set of error detail types
34
- # in the package +google.rpc+ which can be used for common error conditions.
34
+ # in the package +google.rpc+ that can be used for common error conditions.
35
35
  #
36
36
  # = Language mapping
37
37
  #
@@ -54,7 +54,7 @@ module Google
54
54
  # errors.
55
55
  #
56
56
  # * Workflow errors. A typical workflow has multiple steps. Each step may
57
- # have a +Status+ message for error reporting purpose.
57
+ # have a +Status+ message for error reporting.
58
58
  #
59
59
  # * Batch operations. If a client uses batch request and batch response, the
60
60
  # +Status+ message should be used directly inside batch response, one for
@@ -76,8 +76,8 @@ module Google
76
76
  # {Google::Rpc::Status#details} field, or localized by the client.
77
77
  # @!attribute [rw] details
78
78
  # @return [Array<Google::Protobuf::Any>]
79
- # A list of messages that carry the error details. There will be a
80
- # common set of message types for APIs to use.
79
+ # A list of messages that carry the error details. There is a common set of
80
+ # message types for APIs to use.
81
81
  class Status; end
82
82
  end
83
83
  end
@@ -0,0 +1,72 @@
1
+ # Copyright 2017, Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Cloud
17
+ # rubocop:disable LineLength
18
+
19
+ ##
20
+ # # Ruby Client for Google Cloud Speech API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
21
+ #
22
+ # [Google Cloud Speech API][Product Documentation]:
23
+ # Google Cloud Speech API.
24
+ # - [Product Documentation][]
25
+ #
26
+ # ## Quick Start
27
+ # In order to use this library, you first need to go through the following
28
+ # steps:
29
+ #
30
+ # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
31
+ # 2. [Enable the Google Cloud Speech API.](https://console.cloud.google.com/apis/api/speech)
32
+ # 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
33
+ #
34
+ # ### Installation
35
+ # ```
36
+ # $ gem install google-cloud-speech
37
+ # ```
38
+ #
39
+ # ### Preview
40
+ # #### SpeechClient
41
+ # ```rb
42
+ # require "google/cloud/speech"
43
+ #
44
+ # speech_client = Google::Cloud::Speech.new
45
+ # language_code = "en-US"
46
+ # sample_rate_hertz = 44100
47
+ # encoding = :FLAC
48
+ # config = {
49
+ # language_code: language_code,
50
+ # sample_rate_hertz: sample_rate_hertz,
51
+ # encoding: encoding
52
+ # }
53
+ # uri = "gs://gapic-toolkit/hello.flac"
54
+ # audio = { uri: uri }
55
+ # response = speech_client.recognize(config, audio)
56
+ # ```
57
+ #
58
+ # ### Next Steps
59
+ # - Read the [Google Cloud Speech API Product documentation][Product Documentation]
60
+ # to learn more about the product and see How-to Guides.
61
+ # - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
62
+ # to see the full list of Cloud APIs that we cover.
63
+ #
64
+ # [Product Documentation]: https://cloud.google.com/speech
65
+ #
66
+ #
67
+ module Speech
68
+ module V1
69
+ end
70
+ end
71
+ end
72
+ end
@@ -30,6 +30,7 @@ require "google/gax/operation"
30
30
  require "google/longrunning/operations_client"
31
31
 
32
32
  require "google/cloud/speech/v1/cloud_speech_pb"
33
+ require "google/cloud/speech/credentials"
33
34
 
34
35
  module Google
35
36
  module Cloud
@@ -56,21 +57,24 @@ module Google
56
57
  "https://www.googleapis.com/auth/cloud-platform"
57
58
  ].freeze
58
59
 
59
- # @param service_path [String]
60
- # The domain name of the API remote host.
61
- # @param port [Integer]
62
- # The port on which to connect to the remote host.
63
- # @param channel [Channel]
64
- # A Channel object through which to make calls.
65
- # @param chan_creds [Grpc::ChannelCredentials]
66
- # A ChannelCredentials for the setting up the RPC client.
67
- # @param updater_proc [Proc]
68
- # A function that transforms the metadata for requests, e.g., to give
69
- # OAuth credentials.
60
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
61
+ # Provides the means for authenticating requests made by the client. This parameter can
62
+ # be many types.
63
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
64
+ # authenticating requests made by this client.
65
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
66
+ # credentials for this client.
67
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
68
+ # credentials for this client.
69
+ # A `GRPC::Core::Channel` will be used to make calls through.
70
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
71
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
72
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
73
+ # metadata for requests, generally, to give OAuth credentials.
70
74
  # @param scopes [Array<String>]
71
75
  # The OAuth scopes for this service. This parameter is ignored if
72
76
  # an updater_proc is supplied.
73
- # @param client_config[Hash]
77
+ # @param client_config [Hash]
74
78
  # A Hash for call options for each method. See
75
79
  # Google::Gax#construct_settings for the structure of
76
80
  # this data. Falls back to the default config if not specified
@@ -83,11 +87,10 @@ module Google
83
87
  channel: nil,
84
88
  chan_creds: nil,
85
89
  updater_proc: nil,
90
+ credentials: nil,
86
91
  scopes: ALL_SCOPES,
87
92
  client_config: {},
88
93
  timeout: DEFAULT_TIMEOUT,
89
- app_name: nil,
90
- app_version: nil,
91
94
  lib_name: nil,
92
95
  lib_version: ""
93
96
  # These require statements are intentionally placed here to initialize
@@ -96,28 +99,48 @@ module Google
96
99
  require "google/gax/grpc"
97
100
  require "google/cloud/speech/v1/cloud_speech_services_pb"
98
101
 
102
+ if channel || chan_creds || updater_proc
103
+ warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
104
+ "on 2017/09/08"
105
+ credentials ||= channel
106
+ credentials ||= chan_creds
107
+ credentials ||= updater_proc
108
+ end
109
+ if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
110
+ warn "`service_path` and `port` parameters are deprecated and will be removed"
111
+ end
112
+
113
+ credentials ||= Google::Cloud::Speech::Credentials.default
114
+
99
115
  @operations_client = Google::Longrunning::OperationsClient.new(
100
116
  service_path: service_path,
101
- port: port,
102
- channel: channel,
103
- chan_creds: chan_creds,
104
- updater_proc: updater_proc,
117
+ credentials: credentials,
105
118
  scopes: scopes,
106
119
  client_config: client_config,
107
120
  timeout: timeout,
108
- app_name: app_name,
109
- app_version: app_version,
110
121
  lib_name: lib_name,
111
122
  lib_version: lib_version,
112
123
  )
113
124
 
114
- if app_name || app_version
115
- warn "`app_name` and `app_version` are no longer being used in the request headers."
125
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
126
+ updater_proc = Google::Cloud::Speech::Credentials.new(credentials).updater_proc
127
+ end
128
+ if credentials.is_a?(GRPC::Core::Channel)
129
+ channel = credentials
130
+ end
131
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
132
+ chan_creds = credentials
133
+ end
134
+ if credentials.is_a?(Proc)
135
+ updater_proc = credentials
136
+ end
137
+ if credentials.is_a?(Google::Auth::Credentials)
138
+ updater_proc = credentials.updater_proc
116
139
  end
117
140
 
118
141
  google_api_client = "gl-ruby/#{RUBY_VERSION}"
119
142
  google_api_client << " #{lib_name}/#{lib_version}" if lib_name
120
- google_api_client << " gapic/0.6.8 gax/#{Google::Gax::VERSION}"
143
+ google_api_client << " gapic/0.1.0 gax/#{Google::Gax::VERSION}"
121
144
  google_api_client << " grpc/#{GRPC::VERSION}"
122
145
  google_api_client.freeze
123
146
 
@@ -182,7 +205,7 @@ module Google
182
205
  # @example
183
206
  # require "google/cloud/speech/v1"
184
207
  #
185
- # speech_client = Google::Cloud::Speech::V1::SpeechClient.new
208
+ # speech_client = Google::Cloud::Speech::V1.new
186
209
  # encoding = :FLAC
187
210
  # sample_rate_hertz = 44100
188
211
  # language_code = "en-US"
@@ -229,7 +252,7 @@ module Google
229
252
  # @example
230
253
  # require "google/cloud/speech/v1"
231
254
  #
232
- # speech_client = Google::Cloud::Speech::V1::SpeechClient.new
255
+ # speech_client = Google::Cloud::Speech::V1.new
233
256
  # encoding = :FLAC
234
257
  # sample_rate_hertz = 44100
235
258
  # language_code = "en-US"
@@ -309,7 +332,7 @@ module Google
309
332
  # @example
310
333
  # require "google/cloud/speech/v1"
311
334
  #
312
- # speech_client = Google::Cloud::Speech::V1::SpeechClient.new
335
+ # speech_client = Google::Cloud::Speech::V1.new
313
336
  # request = {}
314
337
  # requests = [request]
315
338
  # speech_client.streaming_recognize(requests).each do |element|
@@ -317,7 +340,10 @@ module Google
317
340
  # end
318
341
 
319
342
  def streaming_recognize reqs, options: nil
320
- @streaming_recognize.call(reqs, options)
343
+ request_protos = reqs.lazy.map do |req|
344
+ Google::Gax::to_proto(req, Google::Cloud::Speech::V1::StreamingRecognizeRequest)
345
+ end
346
+ @streaming_recognize.call(request_protos, options)
321
347
  end
322
348
  end
323
349
  end
@@ -31,7 +31,7 @@
31
31
  "retry_params_name": "default"
32
32
  },
33
33
  "StreamingRecognize": {
34
- "timeout_millis": 190000,
34
+ "timeout_millis": 600000,
35
35
  "retry_codes_name": "idempotent",
36
36
  "retry_params_name": "default"
37
37
  }
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Speech
19
- VERSION = "0.26.2"
19
+ VERSION = "0.27.0"
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-speech
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-29 00:00:00.000000000 Z
12
+ date: 2017-11-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.0'
20
+ version: '1.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.0'
27
+ version: '1.1'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: google-gax
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 0.8.2
34
+ version: 0.10.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 0.8.2
41
+ version: 0.10.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: minitest
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +193,7 @@ files:
193
193
  - lib/google/cloud/speech/v1/doc/google/protobuf/any.rb
194
194
  - lib/google/cloud/speech/v1/doc/google/protobuf/duration.rb
195
195
  - lib/google/cloud/speech/v1/doc/google/rpc/status.rb
196
+ - lib/google/cloud/speech/v1/doc/overview.rb
196
197
  - lib/google/cloud/speech/v1/speech_client.rb
197
198
  - lib/google/cloud/speech/v1/speech_client_config.json
198
199
  - lib/google/cloud/speech/version.rb
@@ -216,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  version: '0'
217
218
  requirements: []
218
219
  rubyforge_project:
219
- rubygems_version: 2.6.13
220
+ rubygems_version: 2.7.2
220
221
  signing_key:
221
222
  specification_version: 4
222
223
  summary: API Client library for Google Cloud Speech API