google-cloud-vision 0.32.2 → 1.1.3

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +4 -2
  3. data/AUTHENTICATION.md +151 -0
  4. data/LICENSE.md +201 -0
  5. data/MIGRATING.md +343 -0
  6. data/README.md +97 -52
  7. data/lib/google/cloud/vision/{v1/doc/google/protobuf/empty.rb → version.rb} +10 -13
  8. data/lib/google/cloud/vision.rb +132 -207
  9. data/lib/{google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb → google-cloud-vision.rb} +5 -15
  10. metadata +108 -83
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/vision/v1/credentials.rb +0 -42
  13. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
  14. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -763
  15. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -88
  16. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -539
  17. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
  18. data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
  19. data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -93
  20. data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -130
  21. data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -230
  22. data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -109
  23. data/lib/google/cloud/vision/v1/doc/google/protobuf/wrappers.rb +0 -90
  24. data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -84
  25. data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -156
  26. data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -65
  27. data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
  28. data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
  29. data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -302
  30. data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -36
  31. data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -305
  32. data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -56
  33. data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1337
  34. data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -116
  35. data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -45
  36. data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -191
  37. data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -224
  38. data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
  39. data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
  40. data/lib/google/cloud/vision/v1.rb +0 -233
  41. data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
  42. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
  43. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
  44. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -154
  45. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -533
  46. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -254
  47. data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
  48. data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -93
  49. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -130
  50. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -230
  51. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -109
  52. data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -90
  53. data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -84
  54. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -156
  55. data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -65
  56. data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
  57. data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
  58. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -302
  59. data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
  60. data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -304
  61. data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -55
  62. data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1351
  63. data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
  64. data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -64
  65. data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -191
  66. data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -222
  67. data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
  68. data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
  69. data/lib/google/cloud/vision/v1p3beta1.rb +0 -233
data/MIGRATING.md ADDED
@@ -0,0 +1,343 @@
1
+ ## Migrating to google-cloud-vision 1.0
2
+
3
+ The 1.0 release of the google-cloud-vision 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 multiple libraries. The new gems
13
+ `google-cloud-vision-v1` and `google-cloud-vision-v1p3beta1` contain the
14
+ actual client classes for versions V1 and V1p3beta1 of the Vision service,
15
+ and the gem `google-cloud-vision` now simply provides a convenience wrapper.
16
+ See [Library Structure](#library-structure) for more info.
17
+ * The library uses a new configuration mechanism giving you closer control
18
+ over endpoint address, network timeouts, and retry. See
19
+ [Client Configuration](#client-configuration) for more info. Furthermore,
20
+ when creating a client object, you can customize its configuration in a
21
+ block rather than passing arguments to the constructor. See
22
+ [Creating Clients](#creating-clients) for more info.
23
+ * Previously, positional arguments were used to indicate required arguments.
24
+ Now, all method arguments are keyword arguments, with documentation that
25
+ specifies whether they are required or optional. Additionally, you can pass
26
+ a proto request object instead of separate arguments. See
27
+ [Passing Arguments](#passing-arguments) for more info.
28
+ * Previously, some client classes included class methods for constructing
29
+ resource paths. These paths are now instance methods on the client objects,
30
+ and are also available in a separate paths module. See
31
+ [Resource Path Helpers](#resource-path-helpers) for more info.
32
+ * Previously, the client included a number of high-level convenience methods,
33
+ such as `face_detection`, for detecting particular types of features. These
34
+ methods are still present, but a few of the parameter types (relating to
35
+ call configuration) have changed. See
36
+ [High Level Detection Methods](#high-level-detection-methods) for more info.
37
+ * Previously, clients reported RPC errors by raising instances of
38
+ `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
39
+ `Google::Cloud::Error` and its subclasses. See
40
+ [Handling Errors](#handling-errors) for more info.
41
+ * Some classes have moved into different namespaces. See
42
+ [Class Namespaces](#class-namespaces) for more info.
43
+
44
+ ### Library Structure
45
+
46
+ Older 0.x releases of the `google-cloud-vision` gem were all-in-one gems
47
+ that included potentially multiple clients for multiple versions of the Vision
48
+ service. Factory methods such as `Google::Cloud::Vision::ImageAnnotator.new`
49
+ would return you instances of client classes such as
50
+ `Google::Cloud::Vision::V1::ImageAnnotatorClient` or
51
+ `Google::Cloud::Vision::V1p3beta1::ImageAnnotatorClient`, depending on which
52
+ version of the API requested. These classes were all defined in the same gem.
53
+
54
+ With the 1.0 release, the `google-cloud-vision` gem still provides factory
55
+ methods for obtaining clients. (The method signatures will have changed. See
56
+ [Creating Clients](#creating-clients) for details.) However, the actual client
57
+ classes have been moved into separate gems, one per service version. The
58
+ `Google::Cloud::Vision::V1::ImageAnnotator::Client` class, along with its
59
+ helpers and data types, is now part of the `google-cloud-vision-v1` gem.
60
+ Similarly, the `Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client`
61
+ class is part of the `google-cloud-vision-v1p3beta1` gem.
62
+
63
+ For normal usage, you can continue to install the `google-cloud-vision` gem
64
+ (which will bring in the versioned client gems as dependencies) and continue to
65
+ use factory methods to create clients. However, you may alternatively choose to
66
+ install only one of the versioned gems. For example, if you know you will only
67
+ use `V1` of the service, you can install `google-cloud-vision-v1` by
68
+ itself, and construct instances of the
69
+ `Google::Cloud::Vision::V1::ImageAnnotator::Client` client class directly.
70
+
71
+ ### Client Configuration
72
+
73
+ In older releases, if you wanted to customize performance parameters or
74
+ low-level behavior of the client (such as credentials, timeouts, or
75
+ instrumentation), you would pass a variety of keyword arguments to the client
76
+ constructor. It was also extremely difficult to customize the default settings.
77
+
78
+ With the 1.0 release, a configuration interface provides control over these
79
+ parameters, including defaults for all instances of a client, and settings for
80
+ each specific client instance. For example, to set default credentials and
81
+ timeout for all Vision V1 image annotator clients:
82
+
83
+ ```
84
+ Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
85
+ config.credentials = "/path/to/credentials.json"
86
+ config.timeout = 10.0
87
+ end
88
+ ```
89
+
90
+ Individual RPCs can also be configured independently. For example, to set the
91
+ timeout for the `batch_annotate_images` call:
92
+
93
+ ```
94
+ Google::Cloud::Vision::V1::ImageAnnotator::Client.configure do |config|
95
+ config.rpcs.batch_annotate_images.timeout = 20.0
96
+ end
97
+ ```
98
+
99
+ Defaults for certain configurations can be set for all Vision versions and
100
+ services globally:
101
+
102
+ ```
103
+ Google::Cloud::Vision.configure do |config|
104
+ config.credentials = "/path/to/credentials.json"
105
+ config.timeout = 10.0
106
+ end
107
+ ```
108
+
109
+ Finally, you can override the configuration for each client instance. See the
110
+ next section on [Creating Clients](#creating-clients) for details.
111
+
112
+ ### Creating Clients
113
+
114
+ In older releases, to create a client object, you would use the `new` method
115
+ of modules under `Google::Cloud::Vision`. For example, you might call
116
+ `Google::Cloud::Vision::ImageAnnotator.new`. Keyword arguments were available to
117
+ select a service version and to configure parameters such as credentials and
118
+ timeouts.
119
+
120
+ With the 1.0 release, use named class methods of `Google::Cloud::Vision` to
121
+ create a client object. For example, `Google::Cloud::Vision.image_annotator`.
122
+ You may select a service version using the `:version` keyword argument.
123
+ However, other configuration parameters should be set in a configuration block
124
+ when you create the client.
125
+
126
+ Old:
127
+ ```
128
+ client = Google::Cloud::Vision::ImageAnnotator.new credentials: "/path/to/credentials.json"
129
+ ```
130
+
131
+ New:
132
+ ```
133
+ client = Google::Cloud::Vision.image_annotator do |config|
134
+ config.credentials = "/path/to/credentials.json"
135
+ end
136
+ ```
137
+
138
+ The configuration block is optional. If you do not provide it, or you do not
139
+ set some configuration parameters, then the default configuration is used. See
140
+ [Client Configuration](#client-configuration).
141
+
142
+ ### Passing Arguments
143
+
144
+ In older releases, required arguments would be passed as positional method
145
+ arguments, while most optional arguments would be passed as keyword arguments.
146
+
147
+ With the 1.0 release, all RPC arguments are passed as keyword arguments,
148
+ regardless of whether they are required or optional. For example:
149
+
150
+ Old:
151
+ ```
152
+ client = Google::Cloud::Vision::ImageAnnotator.new
153
+
154
+ requests = my_create_requests
155
+
156
+ # requests is a positional argument
157
+ response = client.batch_annotate_images requests
158
+ ```
159
+
160
+ New:
161
+ ```
162
+ client = Google::Cloud::Vision.image_annotator
163
+
164
+ requests = my_create_requests
165
+
166
+ # requests is a keyword argument
167
+ response = client.batch_annotate_images requests: requests
168
+ ```
169
+
170
+ In the 1.0 release, it is also possible to pass a request object, either
171
+ as a hash or as a protocol buffer.
172
+
173
+ New:
174
+ ```
175
+ client = Google::Cloud::Vision.image_annotator
176
+
177
+ request_object = Google::Cloud::Vision::V1::BatchAnnotateImagesRequest.new(
178
+ requests: my_create_requests
179
+ )
180
+
181
+ # Pass a request object as a positional argument:
182
+ response = client.batch_annotate_images request_object
183
+ ```
184
+
185
+ Finally, in older releases, to provide call options, you would pass a
186
+ `Google::Gax::CallOptions` object with the `:options` keyword argument. In the
187
+ 1.0 release, pass call options using a _second set_ of keyword arguments.
188
+
189
+ Old:
190
+ ```
191
+ client = Google::Cloud::Vision::ImageAnnotator.new
192
+
193
+ requests = my_create_requests
194
+
195
+ options = Google::Gax::CallOptions.new timeout: 10.0
196
+
197
+ response = client.batch_annotate_images requests, options: options
198
+ ```
199
+
200
+ New:
201
+ ```
202
+ client = Google::Cloud::Vision.image_annotator
203
+
204
+ requests = my_create_requests
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.batch_annotate_images({ requests: requests }, timeout: 10.0)
209
+ ```
210
+
211
+ ### Resource Path Helpers
212
+
213
+ The client library includes helper methods for generating the resource path
214
+ strings passed to many calls. These helpers have changed in two ways:
215
+
216
+ * In older releases, they are _class_ methods on the client class. In the 1.0
217
+ release, they are _instance_ methods on the client. They are also available
218
+ on a separate paths module that you can include elsewhere for convenience.
219
+ * In older releases, arguments to a resource path helper are passed as
220
+ _positional_ arguments. In the 1.0 release, they are passed as named _keyword_
221
+ arguments.
222
+
223
+ Following is an example involving using a resource path helper.
224
+
225
+ Old:
226
+ ```
227
+ client = Google::Cloud::Vision::ProductSearch.new
228
+
229
+ # Call the helper on the client class
230
+ location = Google::Cloud::Vision::V1::ProductSearchClient.location_path(
231
+ "my-project", "my-location"
232
+ )
233
+
234
+ product = my_build_product
235
+ response = client.create_product location, product
236
+ ```
237
+
238
+ New:
239
+ ```
240
+ client = Google::Cloud::Vision.product_search
241
+
242
+ # Call the helper on the client instance, and use keyword arguments
243
+ location = client.location_path project: "my-project", location: "my-location"
244
+
245
+ product = my_build_product
246
+ response = client.create_product parent: location, product: product
247
+ ```
248
+
249
+ In the 1.0 client, you can also use the paths module as a convenience module.
250
+
251
+ New:
252
+ ```
253
+ # Bring the path helper methods into the current class
254
+ include Google::Cloud::Vision::V1::ProductSearch::Paths
255
+
256
+ def foo
257
+ client = Google::Cloud::Vision.product_search
258
+
259
+ # Call the included helper method
260
+ location = location_path project: "my-project", location: "my-location"
261
+
262
+ product = my_build_product
263
+ response = client.create_product parent: location, product: product
264
+
265
+ # Do something with response...
266
+ end
267
+ ```
268
+
269
+ ### High Level Detection Methods
270
+
271
+ The client library includes some high-level convenience methods, with names
272
+ such as `face_detection`, for detecting certain types of features. These
273
+ methods are still present, but a few of the argument types have changed.
274
+
275
+ * The `options` keyword argument is used to pass call options such as timeout
276
+ and retry. Older versions of the library took an object of type
277
+ `Google::Gax::CallOptions`. Version 1.0 takes an object of type
278
+ `Gapic::CallOptions`, which is defined in the `gapic-common` gem. Note that
279
+ you can also pass a hash with the same keys that the older library accepted.
280
+ * If `async` is set to `true`, older versions of the library returned an
281
+ object of type `Google::Gax::Operation`. Version 1.0 returns an object of
282
+ type `Gapic::Operation`, which is defined in the `gapic-common` gem. Most
283
+ methods on this object are the same as the older object.
284
+
285
+ ### Handling Errors
286
+
287
+ The client reports standard
288
+ [gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
289
+ by raising exceptions. In older releases, these exceptions were located in the
290
+ `Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
291
+ exception class, defined in the `google-gax` gem. However, these classes were
292
+ different from the standard exceptions (subclasses of `Google::Cloud::Error`)
293
+ thrown by other client libraries such as `google-cloud-storage`.
294
+
295
+ The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
296
+ for consistency across all the Google Cloud client libraries. In general, these
297
+ exceptions have the same name as their counterparts from older releases, but
298
+ are located in the `Google::Cloud` namespace rather than the `Google::Gax`
299
+ namespace.
300
+
301
+ Old:
302
+ ```
303
+ client = Google::Cloud::Vision::ImageAnnotator.new
304
+
305
+ requests = my_create_requests
306
+
307
+ begin
308
+ response = client.batch_annotate_images requests
309
+ rescue Google::Gax::Error => e
310
+ # Handle exceptions that subclass Google::Gax::Error
311
+ end
312
+ ```
313
+
314
+ New:
315
+ ```
316
+ client = Google::Cloud::Vision.image_annotator
317
+
318
+ requests = my_create_requests
319
+
320
+ begin
321
+ response = client.batch_annotate_images requests: requests
322
+ rescue Google::Cloud::Error => e
323
+ # Handle exceptions that subclass Google::Cloud::Error
324
+ end
325
+ ```
326
+
327
+ ### Class Namespaces
328
+
329
+ In older releases, the client object was of classes with names like:
330
+ `Google::Cloud::Vision::V1::ProductSearchClient`.
331
+ In the 1.0 release, the client object is of a different class:
332
+ `Google::Cloud::Vision::V1::ProductSearch::Client`.
333
+ Note that most users will use the factory methods such as
334
+ `Google::Cloud::Vision.product_search` to create instances of the client object,
335
+ so you may not need to reference the actual class directly.
336
+ See [Creating Clients](#creating-clients).
337
+
338
+ In older releases, the credentials object was of class
339
+ `Google::Cloud::Vision::V1::Credentials`.
340
+ In the 1.0 release, each service has its own credentials class, e.g.
341
+ `Google::Cloud::Vision::V1::ProductSearch::Credentials`.
342
+ Again, most users will not need to reference this class directly.
343
+ See [Client Configuration](#client-configuration).
data/README.md CHANGED
@@ -1,67 +1,54 @@
1
- # Ruby Client for Cloud Vision API ([Alpha](https://github.com/googleapis/google-cloud-ruby#versioning))
1
+ # Ruby Client for the Cloud Vision API
2
2
 
3
- [Cloud Vision API][Product Documentation]:
4
- Integrates Google Vision features, including image labeling, face, logo, and
5
- landmark detection, optical character recognition (OCR), and detection of
6
- explicit content, into applications.
7
- - [Client Library Documentation][]
8
- - [Product Documentation][]
3
+ API Client library for the Cloud Vision API
9
4
 
10
- ## Quick Start
11
- In order to use this library, you first need to go through the following
12
- steps:
5
+ Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.
13
6
 
14
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
15
- 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
16
- 3. [Enable the Cloud Vision API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
17
- 4. [Setup Authentication.](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
7
+ Actual client classes for the various versions of this API are defined in
8
+ _versioned_ client gems, with names of the form `google-cloud-vision-v*`.
9
+ The gem `google-cloud-vision` is the main client library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients. More information on versioned clients can be found below
12
+ in the section titled *Which client should I use?*.
13
+
14
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-vision/latest)
15
+ for this library, google-cloud-vision, to see the convenience methods for
16
+ constructing client objects. Reference documentation for the client objects
17
+ themselves can be found in the client library documentation for the versioned
18
+ client gems:
19
+ [google-cloud-vision-v1](https://googleapis.dev/ruby/google-cloud-vision-v1/latest),
20
+ [google-cloud-vision-v1p3beta1](https://googleapis.dev/ruby/google-cloud-vision-v1p3beta1/latest).
21
+
22
+ See also the [Product Documentation](https://cloud.google.com/vision)
23
+ for more usage information.
24
+
25
+ ## Quick Start
18
26
 
19
- ### Installation
20
27
  ```
21
28
  $ gem install google-cloud-vision
22
29
  ```
23
30
 
24
- ### Migration Guide
25
-
26
- The 0.32.0 release introduced breaking changes relative to the previous release,
27
- 0.31.0. For more details and instructions to migrate your code, please visit the
28
- [migration
29
- guide](https://cloud.google.com/vision/docs/ruby-client-migration).
30
-
31
- ### Preview
32
- #### ImageAnnotatorClient
33
- ```rb
34
- require "google/cloud/vision"
35
-
36
- image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new
37
- gcs_image_uri = "gs://gapic-toolkit/President_Barack_Obama.jpg"
38
- source = { gcs_image_uri: gcs_image_uri }
39
- image = { source: source }
40
- type = :FACE_DETECTION
41
- features_element = { type: type }
42
- features = [features_element]
43
- requests_element = { image: image, features: features }
44
- requests = [requests_element]
45
- response = image_annotator_client.batch_annotate_images(requests)
46
- ```
31
+ In order to use this library, you first need to go through the following steps:
47
32
 
48
- ### Next Steps
49
- - Read the [Client Library Documentation][] for Cloud Vision API
50
- to see other available methods on the client.
51
- - Read the [Cloud Vision API Product documentation][Product Documentation]
52
- to learn more about the product and see How-to Guides.
53
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
54
- to see the full list of Cloud APIs that we cover.
33
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
34
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
35
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
36
+ 1. {file:AUTHENTICATION.md Set up authentication.}
55
37
 
56
- [Client Library Documentation]: https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-vision/latest/google/cloud/vision/v1
57
- [Product Documentation]: https://cloud.google.com/vision
38
+ ## Migrating from 0.x versions
39
+
40
+ The 1.0 release of the google-cloud-vision 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.
58
45
 
59
46
  ## Enabling Logging
60
47
 
61
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
62
- 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,
63
- or a [`Google::Cloud::Logging::Logger`](https://googleapis.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
64
- 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)
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
50
+ or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
+ that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
65
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
66
53
 
67
54
  Configuring a Ruby stdlib logger:
@@ -84,11 +71,69 @@ end
84
71
 
85
72
  ## Supported Ruby Versions
86
73
 
87
- This library is supported on Ruby 2.3+.
74
+ This library is supported on Ruby 2.5+.
88
75
 
89
76
  Google provides official support for Ruby versions that are actively supported
90
77
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
91
- in security maintenance, and not end of life. Currently, this means Ruby 2.3
78
+ in security maintenance, and not end of life. Currently, this means Ruby 2.5
92
79
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
93
80
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
94
81
  about the Ruby support schedule.
82
+
83
+ ## Which client should I use?
84
+
85
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
86
+ client library with a name such as `google-cloud-vision`,
87
+ and lower-level _versioned_ client libraries with names such as
88
+ `google-cloud-vision-v1`.
89
+ _In most cases, you should install the main client._
90
+
91
+ ### What's the difference between the main client and a versioned client?
92
+
93
+ A _versioned client_ provides a basic set of data types and client classes for
94
+ a _single version_ of a specific service. (That is, for a service with multiple
95
+ versions, there might be a separate versioned client for each service version.)
96
+ Most versioned clients are written and maintained by a code generator.
97
+
98
+ The _main client_ is designed to provide you with the _recommended_ client
99
+ interfaces for the service. There will be only one main client for any given
100
+ service, even a service with multiple versions. The main client includes
101
+ factory methods for constructing the client objects we recommend for most
102
+ users. In some cases, those will be classes provided by an underlying versioned
103
+ client; in other cases, they will be handwritten higher-level client objects
104
+ with additional capabilities, convenience methods, or best practices built in.
105
+ Generally, the main client will default to a recommended service version,
106
+ although in some cases you can override this if you need to talk to a specific
107
+ service version.
108
+
109
+ ### Why would I want to use the main client?
110
+
111
+ We recommend that most users install the main client gem for a service. You can
112
+ identify this gem as the one _without_ a version in its name, e.g.
113
+ `google-cloud-vision`.
114
+ The main client is recommended because it will embody the best practices for
115
+ accessing the service, and may also provide more convenient interfaces or
116
+ tighter integration into frameworks and third-party libraries. In addition, the
117
+ documentation and samples published by Google will generally demonstrate use of
118
+ the main client.
119
+
120
+ ### Why would I want to use a versioned client?
121
+
122
+ You can use a versioned client if you are content with a possibly lower-level
123
+ class interface, you explicitly want to avoid features provided by the main
124
+ client, or you want to access a specific service version not be covered by the
125
+ main client. You can identify versioned client gems because the service version
126
+ is part of the name, e.g. `google-cloud-vision-v1`.
127
+
128
+ ### What about the google-apis-<name> clients?
129
+
130
+ Client library gems with names that begin with `google-apis-` are based on an
131
+ older code generation technology. They talk to a REST/JSON backend (whereas
132
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
133
+ not offer the same performance, features, and ease of use provided by more
134
+ modern clients.
135
+
136
+ The `google-apis-` clients have wide coverage across Google services, so you
137
+ might need to use one if there is no modern client available for the service.
138
+ However, if a modern client is available, we generally recommend it over the
139
+ older `google-apis-` clients.
@@ -1,4 +1,6 @@
1
- # Copyright 2018 Google LLC
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
4
6
  # you may not use this file except in compliance with the License.
@@ -12,18 +14,13 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
15
19
 
16
20
  module Google
17
- module Protobuf
18
- # A generic empty message that you can re-use to avoid defining duplicated
19
- # empty messages in your APIs. A typical example is to use it as the request
20
- # or the response type of an API method. For instance:
21
- #
22
- # service Foo {
23
- # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
- # }
25
- #
26
- # The JSON representation for `Empty` is empty JSON object `{}`.
27
- class Empty; end
21
+ module Cloud
22
+ module Vision
23
+ VERSION = "1.1.3"
24
+ end
28
25
  end
29
- end
26
+ end