google-cloud-speech 0.32.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +4 -1
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/MIGRATING.md +367 -0
- data/README.md +97 -52
- data/lib/google/cloud/speech/version.rb +22 -0
- data/lib/google/cloud/speech.rb +88 -139
- data/lib/google-cloud-speech.rb +19 -0
- metadata +111 -49
- data/LICENSE +0 -201
- data/lib/google/cloud/speech/v1/cloud_speech_pb.rb +0 -129
- data/lib/google/cloud/speech/v1/cloud_speech_services_pb.rb +0 -56
- data/lib/google/cloud/speech/v1/credentials.rb +0 -41
- data/lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb +0 -482
- data/lib/google/cloud/speech/v1/doc/google/longrunning/operations.rb +0 -93
- data/lib/google/cloud/speech/v1/doc/google/protobuf/any.rb +0 -130
- data/lib/google/cloud/speech/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/speech/v1/doc/google/rpc/status.rb +0 -84
- data/lib/google/cloud/speech/v1/helpers.rb +0 -136
- data/lib/google/cloud/speech/v1/speech_client.rb +0 -331
- data/lib/google/cloud/speech/v1/speech_client_config.json +0 -41
- data/lib/google/cloud/speech/v1/stream.rb +0 -614
- data/lib/google/cloud/speech/v1.rb +0 -157
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +0 -190
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb +0 -56
- data/lib/google/cloud/speech/v1p1beta1/credentials.rb +0 -41
- data/lib/google/cloud/speech/v1p1beta1/doc/google/cloud/speech/v1p1beta1/cloud_speech.rb +0 -719
- data/lib/google/cloud/speech/v1p1beta1/doc/google/longrunning/operations.rb +0 -93
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/any.rb +0 -130
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/speech/v1p1beta1/doc/google/rpc/status.rb +0 -84
- data/lib/google/cloud/speech/v1p1beta1/helpers.rb +0 -136
- data/lib/google/cloud/speech/v1p1beta1/speech_client.rb +0 -331
- data/lib/google/cloud/speech/v1p1beta1/speech_client_config.json +0 -41
- data/lib/google/cloud/speech/v1p1beta1/stream.rb +0 -614
- data/lib/google/cloud/speech/v1p1beta1.rb +0 -157
@@ -1,157 +0,0 @@
|
|
1
|
-
# Copyright 2018 Google LLC
|
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
|
-
# https://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
|
-
|
16
|
-
require "google/cloud/speech/v1p1beta1/speech_client"
|
17
|
-
require "google/cloud/speech/v1p1beta1/helpers"
|
18
|
-
|
19
|
-
module Google
|
20
|
-
module Cloud
|
21
|
-
module Speech
|
22
|
-
# rubocop:disable LineLength
|
23
|
-
|
24
|
-
##
|
25
|
-
# # Ruby Client for Cloud Speech API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
|
26
|
-
#
|
27
|
-
# [Cloud Speech API][Product Documentation]:
|
28
|
-
# Converts audio to text by applying powerful neural network models.
|
29
|
-
# - [Product Documentation][]
|
30
|
-
#
|
31
|
-
# ## Quick Start
|
32
|
-
# In order to use this library, you first need to go through the following
|
33
|
-
# steps:
|
34
|
-
#
|
35
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
36
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
37
|
-
# 3. [Enable the Cloud Speech API.](https://console.cloud.google.com/apis/library/speech.googleapis.com)
|
38
|
-
# 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
39
|
-
#
|
40
|
-
# ### Installation
|
41
|
-
# ```
|
42
|
-
# $ gem install google-cloud-speech
|
43
|
-
# ```
|
44
|
-
#
|
45
|
-
# ### Preview
|
46
|
-
# #### SpeechClient
|
47
|
-
# ```rb
|
48
|
-
# require "google/cloud/speech"
|
49
|
-
#
|
50
|
-
# speech_client = Google::Cloud::Speech.new(version: :v1p1beta1)
|
51
|
-
# language_code = "en-US"
|
52
|
-
# sample_rate_hertz = 44100
|
53
|
-
# encoding = :FLAC
|
54
|
-
# config = {
|
55
|
-
# language_code: language_code,
|
56
|
-
# sample_rate_hertz: sample_rate_hertz,
|
57
|
-
# encoding: encoding
|
58
|
-
# }
|
59
|
-
# uri = "gs://bucket-name/hello.flac"
|
60
|
-
# audio = { uri: uri }
|
61
|
-
# response = speech_client.recognize(config, audio)
|
62
|
-
# ```
|
63
|
-
#
|
64
|
-
# ### Next Steps
|
65
|
-
# - Read the [Cloud Speech API Product documentation][Product Documentation]
|
66
|
-
# to learn more about the product and see How-to Guides.
|
67
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
68
|
-
# to see the full list of Cloud APIs that we cover.
|
69
|
-
#
|
70
|
-
# [Product Documentation]: https://cloud.google.com/speech
|
71
|
-
#
|
72
|
-
# ## Enabling Logging
|
73
|
-
#
|
74
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
75
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
76
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
77
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
78
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
79
|
-
#
|
80
|
-
# Configuring a Ruby stdlib logger:
|
81
|
-
#
|
82
|
-
# ```ruby
|
83
|
-
# require "logger"
|
84
|
-
#
|
85
|
-
# module MyLogger
|
86
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
87
|
-
# def logger
|
88
|
-
# LOGGER
|
89
|
-
# end
|
90
|
-
# end
|
91
|
-
#
|
92
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
93
|
-
# module GRPC
|
94
|
-
# extend MyLogger
|
95
|
-
# end
|
96
|
-
# ```
|
97
|
-
#
|
98
|
-
module V1p1beta1
|
99
|
-
# rubocop:enable LineLength
|
100
|
-
|
101
|
-
##
|
102
|
-
# Service that implements Google Cloud Speech API.
|
103
|
-
#
|
104
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
105
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
106
|
-
# be many types.
|
107
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
108
|
-
# authenticating requests made by this client.
|
109
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
110
|
-
# credentials for this client.
|
111
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
112
|
-
# credentials for this client.
|
113
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
114
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
115
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
116
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
117
|
-
# metadata for requests, generally, to give OAuth credentials.
|
118
|
-
# @param scopes [Array<String>]
|
119
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
120
|
-
# an updater_proc is supplied.
|
121
|
-
# @param client_config [Hash]
|
122
|
-
# A Hash for call options for each method. See
|
123
|
-
# Google::Gax#construct_settings for the structure of
|
124
|
-
# this data. Falls back to the default config if not specified
|
125
|
-
# or the specified config is missing data points.
|
126
|
-
# @param timeout [Numeric]
|
127
|
-
# The default timeout, in seconds, for calls made through this client.
|
128
|
-
# @param metadata [Hash]
|
129
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
130
|
-
# @param exception_transformer [Proc]
|
131
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
132
|
-
# custom error handling.
|
133
|
-
def self.new \
|
134
|
-
credentials: nil,
|
135
|
-
scopes: nil,
|
136
|
-
client_config: nil,
|
137
|
-
timeout: nil,
|
138
|
-
metadata: nil,
|
139
|
-
exception_transformer: nil,
|
140
|
-
lib_name: nil,
|
141
|
-
lib_version: nil
|
142
|
-
kwargs = {
|
143
|
-
credentials: credentials,
|
144
|
-
scopes: scopes,
|
145
|
-
client_config: client_config,
|
146
|
-
timeout: timeout,
|
147
|
-
metadata: metadata,
|
148
|
-
exception_transformer: exception_transformer,
|
149
|
-
lib_name: lib_name,
|
150
|
-
lib_version: lib_version
|
151
|
-
}.select { |_, v| v != nil }
|
152
|
-
Google::Cloud::Speech::V1p1beta1::SpeechClient.new(**kwargs)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|