picguard 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +10 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/Rakefile +6 -0
- data/bin/console +6 -0
- data/bin/setup +8 -0
- data/circle.yml +3 -0
- data/lib/configuration.rb +11 -0
- data/lib/google/apis/vision_v1.rb +37 -0
- data/lib/google/apis/vision_v1/classes.rb +1259 -0
- data/lib/google/apis/vision_v1/representations.rb +370 -0
- data/lib/google/apis/vision_v1/service.rb +91 -0
- data/lib/guard_validator.rb +58 -0
- data/lib/picguard.rb +40 -0
- data/lib/picguard/version.rb +3 -0
- data/lib/services/analyzer.rb +40 -0
- data/lib/services/builders/annotate_image.rb +16 -0
- data/lib/services/builders/batch.rb +15 -0
- data/lib/services/builders/feature.rb +16 -0
- data/lib/services/builders/image.rb +15 -0
- data/lib/services/builders/request.rb +27 -0
- data/lib/services/builders/vision.rb +17 -0
- data/lib/services/image_preparator.rb +46 -0
- data/lib/services/validators/likelihood.rb +31 -0
- data/picguard.gemspec +30 -0
- data/spec/guard_validator_spec.rb +72 -0
- data/spec/picguard_spec.rb +22 -0
- data/spec/services/analyzer_spec.rb +33 -0
- data/spec/services/builders/annotate_image_spec.rb +15 -0
- data/spec/services/builders/batch_spec.rb +18 -0
- data/spec/services/builders/feature_spec.rb +26 -0
- data/spec/services/builders/image_spec.rb +12 -0
- data/spec/services/builders/vision_spec.rb +14 -0
- data/spec/services/image_preparator_spec.rb +36 -0
- data/spec/services/validators/likelihood_spec.rb +26 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/img/cat.jpg +0 -0
- data/spec/support/img/face-example.jpg +0 -0
- data/spec/support/img/gun-violence.jpg +0 -0
- data/spec/support/result_hash_stub.rb +212 -0
- metadata +64 -4
@@ -0,0 +1,370 @@
|
|
1
|
+
# Copyright 2015 Google Inc.
|
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
|
+
require 'date'
|
16
|
+
require 'google/apis/core/base_service'
|
17
|
+
require 'google/apis/core/json_representation'
|
18
|
+
require 'google/apis/core/hashable'
|
19
|
+
require 'google/apis/errors'
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Apis
|
23
|
+
module VisionV1
|
24
|
+
|
25
|
+
class ImageSource
|
26
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
27
|
+
end
|
28
|
+
|
29
|
+
class AnnotateImageRequest
|
30
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
31
|
+
end
|
32
|
+
|
33
|
+
class AnnotateImageResponse
|
34
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
35
|
+
end
|
36
|
+
|
37
|
+
class LatLongRect
|
38
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
39
|
+
end
|
40
|
+
|
41
|
+
class Status
|
42
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
43
|
+
end
|
44
|
+
|
45
|
+
class FaceAnnotation
|
46
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Vertex
|
50
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
51
|
+
end
|
52
|
+
|
53
|
+
class ColorInfo
|
54
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
55
|
+
end
|
56
|
+
|
57
|
+
class BoundingPoly
|
58
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
59
|
+
end
|
60
|
+
|
61
|
+
class Landmark
|
62
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
63
|
+
end
|
64
|
+
|
65
|
+
class ImageContext
|
66
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
67
|
+
end
|
68
|
+
|
69
|
+
class BatchAnnotateImagesRequest
|
70
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
71
|
+
end
|
72
|
+
|
73
|
+
class EntityAnnotation
|
74
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
75
|
+
end
|
76
|
+
|
77
|
+
class Property
|
78
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
79
|
+
end
|
80
|
+
|
81
|
+
class Color
|
82
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
83
|
+
end
|
84
|
+
|
85
|
+
class LocationInfo
|
86
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
87
|
+
end
|
88
|
+
|
89
|
+
class SafeSearchAnnotation
|
90
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
91
|
+
end
|
92
|
+
|
93
|
+
class Image
|
94
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
95
|
+
end
|
96
|
+
|
97
|
+
class DominantColorsAnnotation
|
98
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Feature
|
102
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
103
|
+
end
|
104
|
+
|
105
|
+
class BatchAnnotateImagesResponse
|
106
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
107
|
+
end
|
108
|
+
|
109
|
+
class ImageProperties
|
110
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
111
|
+
end
|
112
|
+
|
113
|
+
class Position
|
114
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
115
|
+
end
|
116
|
+
|
117
|
+
class LatLng
|
118
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
119
|
+
end
|
120
|
+
|
121
|
+
class ImageSource
|
122
|
+
# @private
|
123
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
124
|
+
property :gcs_image_uri, as: 'gcsImageUri'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class AnnotateImageRequest
|
129
|
+
# @private
|
130
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
131
|
+
property :image, as: 'image', class: Google::Apis::VisionV1::Image, decorator: Google::Apis::VisionV1::Image::Representation
|
132
|
+
|
133
|
+
property :image_context, as: 'imageContext', class: Google::Apis::VisionV1::ImageContext, decorator: Google::Apis::VisionV1::ImageContext::Representation
|
134
|
+
|
135
|
+
collection :features, as: 'features', class: Google::Apis::VisionV1::Feature, decorator: Google::Apis::VisionV1::Feature::Representation
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
class AnnotateImageResponse
|
141
|
+
# @private
|
142
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
143
|
+
collection :label_annotations, as: 'labelAnnotations', class: Google::Apis::VisionV1::EntityAnnotation, decorator: Google::Apis::VisionV1::EntityAnnotation::Representation
|
144
|
+
|
145
|
+
collection :landmark_annotations, as: 'landmarkAnnotations', class: Google::Apis::VisionV1::EntityAnnotation, decorator: Google::Apis::VisionV1::EntityAnnotation::Representation
|
146
|
+
|
147
|
+
property :safe_search_annotation, as: 'safeSearchAnnotation', class: Google::Apis::VisionV1::SafeSearchAnnotation, decorator: Google::Apis::VisionV1::SafeSearchAnnotation::Representation
|
148
|
+
|
149
|
+
property :image_properties_annotation, as: 'imagePropertiesAnnotation', class: Google::Apis::VisionV1::ImageProperties, decorator: Google::Apis::VisionV1::ImageProperties::Representation
|
150
|
+
|
151
|
+
collection :text_annotations, as: 'textAnnotations', class: Google::Apis::VisionV1::EntityAnnotation, decorator: Google::Apis::VisionV1::EntityAnnotation::Representation
|
152
|
+
|
153
|
+
collection :logo_annotations, as: 'logoAnnotations', class: Google::Apis::VisionV1::EntityAnnotation, decorator: Google::Apis::VisionV1::EntityAnnotation::Representation
|
154
|
+
|
155
|
+
collection :face_annotations, as: 'faceAnnotations', class: Google::Apis::VisionV1::FaceAnnotation, decorator: Google::Apis::VisionV1::FaceAnnotation::Representation
|
156
|
+
|
157
|
+
property :error, as: 'error', class: Google::Apis::VisionV1::Status, decorator: Google::Apis::VisionV1::Status::Representation
|
158
|
+
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
class LatLongRect
|
163
|
+
# @private
|
164
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
165
|
+
property :max_lat_lng, as: 'maxLatLng', class: Google::Apis::VisionV1::LatLng, decorator: Google::Apis::VisionV1::LatLng::Representation
|
166
|
+
|
167
|
+
property :min_lat_lng, as: 'minLatLng', class: Google::Apis::VisionV1::LatLng, decorator: Google::Apis::VisionV1::LatLng::Representation
|
168
|
+
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class Status
|
173
|
+
# @private
|
174
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
175
|
+
property :code, as: 'code'
|
176
|
+
collection :details, as: 'details'
|
177
|
+
property :message, as: 'message'
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
class FaceAnnotation
|
182
|
+
# @private
|
183
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
184
|
+
property :tilt_angle, as: 'tiltAngle'
|
185
|
+
property :under_exposed_likelihood, as: 'underExposedLikelihood'
|
186
|
+
property :fd_bounding_poly, as: 'fdBoundingPoly', class: Google::Apis::VisionV1::BoundingPoly, decorator: Google::Apis::VisionV1::BoundingPoly::Representation
|
187
|
+
|
188
|
+
property :landmarking_confidence, as: 'landmarkingConfidence'
|
189
|
+
property :joy_likelihood, as: 'joyLikelihood'
|
190
|
+
property :detection_confidence, as: 'detectionConfidence'
|
191
|
+
property :surprise_likelihood, as: 'surpriseLikelihood'
|
192
|
+
property :anger_likelihood, as: 'angerLikelihood'
|
193
|
+
property :headwear_likelihood, as: 'headwearLikelihood'
|
194
|
+
property :bounding_poly, as: 'boundingPoly', class: Google::Apis::VisionV1::BoundingPoly, decorator: Google::Apis::VisionV1::BoundingPoly::Representation
|
195
|
+
|
196
|
+
property :pan_angle, as: 'panAngle'
|
197
|
+
collection :landmarks, as: 'landmarks', class: Google::Apis::VisionV1::Landmark, decorator: Google::Apis::VisionV1::Landmark::Representation
|
198
|
+
|
199
|
+
property :blurred_likelihood, as: 'blurredLikelihood'
|
200
|
+
property :roll_angle, as: 'rollAngle'
|
201
|
+
property :sorrow_likelihood, as: 'sorrowLikelihood'
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
class Vertex
|
206
|
+
# @private
|
207
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
208
|
+
property :y, as: 'y'
|
209
|
+
property :x, as: 'x'
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
class ColorInfo
|
214
|
+
# @private
|
215
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
216
|
+
property :pixel_fraction, as: 'pixelFraction'
|
217
|
+
property :color, as: 'color', class: Google::Apis::VisionV1::Color, decorator: Google::Apis::VisionV1::Color::Representation
|
218
|
+
|
219
|
+
property :score, as: 'score'
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
class BoundingPoly
|
224
|
+
# @private
|
225
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
226
|
+
collection :vertices, as: 'vertices', class: Google::Apis::VisionV1::Vertex, decorator: Google::Apis::VisionV1::Vertex::Representation
|
227
|
+
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
class Landmark
|
232
|
+
# @private
|
233
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
234
|
+
property :position, as: 'position', class: Google::Apis::VisionV1::Position, decorator: Google::Apis::VisionV1::Position::Representation
|
235
|
+
|
236
|
+
property :type, as: 'type'
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
class ImageContext
|
241
|
+
# @private
|
242
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
243
|
+
collection :language_hints, as: 'languageHints'
|
244
|
+
property :lat_long_rect, as: 'latLongRect', class: Google::Apis::VisionV1::LatLongRect, decorator: Google::Apis::VisionV1::LatLongRect::Representation
|
245
|
+
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
class BatchAnnotateImagesRequest
|
250
|
+
# @private
|
251
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
252
|
+
collection :requests, as: 'requests', class: Google::Apis::VisionV1::AnnotateImageRequest, decorator: Google::Apis::VisionV1::AnnotateImageRequest::Representation
|
253
|
+
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
class EntityAnnotation
|
258
|
+
# @private
|
259
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
260
|
+
property :mid, as: 'mid'
|
261
|
+
property :description, as: 'description'
|
262
|
+
property :topicality, as: 'topicality'
|
263
|
+
property :locale, as: 'locale'
|
264
|
+
collection :properties, as: 'properties', class: Google::Apis::VisionV1::Property, decorator: Google::Apis::VisionV1::Property::Representation
|
265
|
+
|
266
|
+
property :score, as: 'score'
|
267
|
+
property :bounding_poly, as: 'boundingPoly', class: Google::Apis::VisionV1::BoundingPoly, decorator: Google::Apis::VisionV1::BoundingPoly::Representation
|
268
|
+
|
269
|
+
collection :locations, as: 'locations', class: Google::Apis::VisionV1::LocationInfo, decorator: Google::Apis::VisionV1::LocationInfo::Representation
|
270
|
+
|
271
|
+
property :confidence, as: 'confidence'
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
class Property
|
276
|
+
# @private
|
277
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
278
|
+
property :value, as: 'value'
|
279
|
+
property :name, as: 'name'
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
class Color
|
284
|
+
# @private
|
285
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
286
|
+
property :green, as: 'green'
|
287
|
+
property :blue, as: 'blue'
|
288
|
+
property :red, as: 'red'
|
289
|
+
property :alpha, as: 'alpha'
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
class LocationInfo
|
294
|
+
# @private
|
295
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
296
|
+
property :lat_lng, as: 'latLng', class: Google::Apis::VisionV1::LatLng, decorator: Google::Apis::VisionV1::LatLng::Representation
|
297
|
+
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
class SafeSearchAnnotation
|
302
|
+
# @private
|
303
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
304
|
+
property :medical, as: 'medical'
|
305
|
+
property :violence, as: 'violence'
|
306
|
+
property :spoof, as: 'spoof'
|
307
|
+
property :adult, as: 'adult'
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
class Image
|
312
|
+
# @private
|
313
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
314
|
+
property :source, as: 'source', class: Google::Apis::VisionV1::ImageSource, decorator: Google::Apis::VisionV1::ImageSource::Representation
|
315
|
+
|
316
|
+
property :content, :base64 => true, as: 'content'
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
class DominantColorsAnnotation
|
321
|
+
# @private
|
322
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
323
|
+
collection :colors, as: 'colors', class: Google::Apis::VisionV1::ColorInfo, decorator: Google::Apis::VisionV1::ColorInfo::Representation
|
324
|
+
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
class Feature
|
329
|
+
# @private
|
330
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
331
|
+
property :max_results, as: 'maxResults'
|
332
|
+
property :type, as: 'type'
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
class BatchAnnotateImagesResponse
|
337
|
+
# @private
|
338
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
339
|
+
collection :responses, as: 'responses', class: Google::Apis::VisionV1::AnnotateImageResponse, decorator: Google::Apis::VisionV1::AnnotateImageResponse::Representation
|
340
|
+
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
class ImageProperties
|
345
|
+
# @private
|
346
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
347
|
+
property :dominant_colors, as: 'dominantColors', class: Google::Apis::VisionV1::DominantColorsAnnotation, decorator: Google::Apis::VisionV1::DominantColorsAnnotation::Representation
|
348
|
+
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
class Position
|
353
|
+
# @private
|
354
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
355
|
+
property :y, as: 'y'
|
356
|
+
property :z, as: 'z'
|
357
|
+
property :x, as: 'x'
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
class LatLng
|
362
|
+
# @private
|
363
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
364
|
+
property :longitude, as: 'longitude'
|
365
|
+
property :latitude, as: 'latitude'
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Copyright 2015 Google Inc.
|
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
|
+
require 'google/apis/core/base_service'
|
16
|
+
require 'google/apis/core/json_representation'
|
17
|
+
require 'google/apis/core/hashable'
|
18
|
+
require 'google/apis/errors'
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Apis
|
22
|
+
module VisionV1
|
23
|
+
# Cloud Vision API
|
24
|
+
#
|
25
|
+
# The Google Cloud Vision API allows developers to easily integrate Google
|
26
|
+
# vision features, including image labeling, face, logo, and landmark detection,
|
27
|
+
# optical character recognition (OCR), and detection of explicit content, into
|
28
|
+
# applications.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# require 'google/apis/vision_v1'
|
32
|
+
#
|
33
|
+
# Vision = Google::Apis::VisionV1 # Alias the module
|
34
|
+
# service = Vision::VisionService.new
|
35
|
+
#
|
36
|
+
# @see https://cloud.google.com/vision/
|
37
|
+
class VisionService < Google::Apis::Core::BaseService
|
38
|
+
# @return [String]
|
39
|
+
# API key. Your API key identifies your project and provides you with API access,
|
40
|
+
# quota, and reports. Required unless you provide an OAuth 2.0 token.
|
41
|
+
attr_accessor :key
|
42
|
+
|
43
|
+
# @return [String]
|
44
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
45
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
46
|
+
attr_accessor :quota_user
|
47
|
+
|
48
|
+
def initialize
|
49
|
+
super('https://vision.googleapis.com/', '')
|
50
|
+
end
|
51
|
+
|
52
|
+
# Run image detection and annotation for a batch of images.
|
53
|
+
# @param [Google::Apis::VisionV1::BatchAnnotateImagesRequest] batch_annotate_images_request_object
|
54
|
+
# @param [String] quota_user
|
55
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
56
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
57
|
+
# @param [String] fields
|
58
|
+
# Selector specifying which fields to include in a partial response.
|
59
|
+
# @param [Google::Apis::RequestOptions] options
|
60
|
+
# Request-specific options
|
61
|
+
#
|
62
|
+
# @yield [result, err] Result & error if block supplied
|
63
|
+
# @yieldparam result [Google::Apis::VisionV1::BatchAnnotateImagesResponse] parsed result object
|
64
|
+
# @yieldparam err [StandardError] error object if request failed
|
65
|
+
#
|
66
|
+
# @return [Google::Apis::VisionV1::BatchAnnotateImagesResponse]
|
67
|
+
#
|
68
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
69
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
70
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
71
|
+
def annotate_image(batch_annotate_images_request_object = nil, quota_user: nil, fields: nil, options: nil, &block)
|
72
|
+
command = make_simple_command(:post, 'v1/images:annotate', options)
|
73
|
+
command.request_representation = Google::Apis::VisionV1::BatchAnnotateImagesRequest::Representation
|
74
|
+
command.request_object = batch_annotate_images_request_object
|
75
|
+
command.response_representation = Google::Apis::VisionV1::BatchAnnotateImagesResponse::Representation
|
76
|
+
command.response_class = Google::Apis::VisionV1::BatchAnnotateImagesResponse
|
77
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
78
|
+
command.query['fields'] = fields unless fields.nil?
|
79
|
+
execute_or_queue_command(command, &block)
|
80
|
+
end
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
def apply_command_defaults(command)
|
85
|
+
command.query['key'] = key unless key.nil?
|
86
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|