google-cloud-vision 0.20.2 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,10 +27,9 @@ module Google
27
27
  # See {Annotation#faces} and {Annotation#face}.
28
28
  #
29
29
  # @example
30
- # require "google/cloud"
30
+ # require "google/cloud/vision"
31
31
  #
32
- # gcloud = Google::Cloud.new
33
- # vision = gcloud.vision
32
+ # vision = Google::Cloud::Vision.new
34
33
  #
35
34
  # image = vision.image "path/to/face.jpg"
36
35
  #
@@ -39,13 +38,13 @@ module Google
39
38
  #
40
39
  class Face
41
40
  ##
42
- # @private The FaceAnnotation Google API Client object.
43
- attr_accessor :gapi
41
+ # @private The FaceAnnotation GRPC object.
42
+ attr_accessor :grpc
44
43
 
45
44
  ##
46
45
  # @private Creates a new Face instance.
47
46
  def initialize
48
- @gapi = {}
47
+ @grpc = nil
49
48
  end
50
49
 
51
50
  ##
@@ -54,7 +53,7 @@ module Google
54
53
  # @return [Angles]
55
54
  #
56
55
  def angles
57
- @angles ||= Angles.from_gapi @gapi
56
+ @angles ||= Angles.from_grpc @grpc
58
57
  end
59
58
 
60
59
  ##
@@ -64,7 +63,7 @@ module Google
64
63
  # @return [Bounds]
65
64
  #
66
65
  def bounds
67
- @bounds ||= Bounds.from_gapi @gapi
66
+ @bounds ||= Bounds.from_grpc @grpc
68
67
  end
69
68
 
70
69
  ##
@@ -74,7 +73,7 @@ module Google
74
73
  # @return [Features]
75
74
  #
76
75
  def features
77
- @features ||= Features.from_gapi @gapi
76
+ @features ||= Features.from_grpc @grpc
78
77
  end
79
78
 
80
79
  ##
@@ -84,7 +83,7 @@ module Google
84
83
  # @return [Likelihood]
85
84
  #
86
85
  def likelihood
87
- @likelihood ||= Likelihood.from_gapi @gapi
86
+ @likelihood ||= Likelihood.from_grpc @grpc
88
87
  end
89
88
 
90
89
  ##
@@ -93,7 +92,7 @@ module Google
93
92
  # @return [Float] A value in the range [0, 1].
94
93
  #
95
94
  def confidence
96
- @gapi.detection_confidence
95
+ @grpc.detection_confidence
97
96
  end
98
97
 
99
98
  ##
@@ -118,9 +117,9 @@ module Google
118
117
  end
119
118
 
120
119
  ##
121
- # @private New Annotation::Face from a Google API Client object.
122
- def self.from_gapi gapi
123
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
120
+ # @private New Annotation::Face from a GRPC object.
121
+ def self.from_grpc grpc
122
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
124
123
  end
125
124
 
126
125
  ##
@@ -131,10 +130,9 @@ module Google
131
130
  # See {Face}.
132
131
  #
133
132
  # @example
134
- # require "google/cloud"
133
+ # require "google/cloud/vision"
135
134
  #
136
- # gcloud = Google::Cloud.new
137
- # vision = gcloud.vision
135
+ # vision = Google::Cloud::Vision.new
138
136
  #
139
137
  # image = vision.image "path/to/face.jpg"
140
138
  # face = image.face
@@ -145,13 +143,13 @@ module Google
145
143
  #
146
144
  class Angles
147
145
  ##
148
- # @private The FaceAnnotation Google API Client object.
149
- attr_accessor :gapi
146
+ # @private The FaceAnnotation GRPC object.
147
+ attr_accessor :grpc
150
148
 
151
149
  ##
152
150
  # @private Creates a new Angles instance.
153
151
  def initialize
154
- @gapi = {}
152
+ @grpc = nil
155
153
  end
156
154
 
157
155
  ##
@@ -162,7 +160,7 @@ module Google
162
160
  # @return [Float] A value in the range [-180,180].
163
161
  #
164
162
  def roll
165
- @gapi.roll_angle
163
+ @grpc.roll_angle
166
164
  end
167
165
 
168
166
  ##
@@ -173,7 +171,7 @@ module Google
173
171
  # @return [Float] A value in the range [-180,180].
174
172
  #
175
173
  def yaw
176
- @gapi.pan_angle
174
+ @grpc.pan_angle
177
175
  end
178
176
  alias_method :pan, :yaw
179
177
 
@@ -184,7 +182,7 @@ module Google
184
182
  # @return [Float] A value in the range [-180,180].
185
183
  #
186
184
  def pitch
187
- @gapi.tilt_angle
185
+ @grpc.tilt_angle
188
186
  end
189
187
  alias_method :tilt, :pitch
190
188
 
@@ -218,10 +216,10 @@ module Google
218
216
  end
219
217
 
220
218
  ##
221
- # @private New Annotation::Face::Angles from a Google API Client
219
+ # @private New Annotation::Face::Angles from a GRPC
222
220
  # object.
223
- def self.from_gapi gapi
224
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
221
+ def self.from_grpc grpc
222
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
225
223
  end
226
224
  end
227
225
 
@@ -233,10 +231,9 @@ module Google
233
231
  # See {Face}.
234
232
  #
235
233
  # @example
236
- # require "google/cloud"
234
+ # require "google/cloud/vision"
237
235
  #
238
- # gcloud = Google::Cloud.new
239
- # vision = gcloud.vision
236
+ # vision = Google::Cloud::Vision.new
240
237
  #
241
238
  # image = vision.image "path/to/face.jpg"
242
239
  # face = image.face
@@ -246,13 +243,13 @@ module Google
246
243
  #
247
244
  class Bounds
248
245
  ##
249
- # @private The FaceAnnotation Google API Client object.
250
- attr_accessor :gapi
246
+ # @private The FaceAnnotation GRPC object.
247
+ attr_accessor :grpc
251
248
 
252
249
  ##
253
250
  # @private Creates a new Bounds instance.
254
251
  def initialize
255
- @gapi = {}
252
+ @grpc = nil
256
253
  end
257
254
 
258
255
  ##
@@ -264,9 +261,9 @@ module Google
264
261
  # generated in the BoundingPoly (the polygon will be unbounded) if
265
262
  # only a partial face appears in the image to be annotated.
266
263
  def head
267
- return [] unless @gapi.bounding_poly
268
- @head ||= Array(@gapi.bounding_poly.vertices).map do |v|
269
- Vertex.from_gapi v
264
+ return [] unless @grpc.bounding_poly
265
+ @head ||= Array(@grpc.bounding_poly.vertices).map do |v|
266
+ Vertex.from_grpc v
270
267
  end
271
268
  end
272
269
 
@@ -277,9 +274,9 @@ module Google
277
274
  # skin" visible in an image. It is not based on the landmarks, only
278
275
  # on the initial face detection.
279
276
  def face
280
- return [] unless @gapi.fd_bounding_poly
281
- @face ||= Array(@gapi.fd_bounding_poly.vertices).map do |v|
282
- Vertex.from_gapi v
277
+ return [] unless @grpc.fd_bounding_poly
278
+ @face ||= Array(@grpc.fd_bounding_poly.vertices).map do |v|
279
+ Vertex.from_grpc v
283
280
  end
284
281
  end
285
282
 
@@ -312,10 +309,10 @@ module Google
312
309
  end
313
310
 
314
311
  ##
315
- # @private New Annotation::Face::Angles from a Google API Client
312
+ # @private New Annotation::Face::Angles from a GRPC
316
313
  # object.
317
- def self.from_gapi gapi
318
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
314
+ def self.from_grpc grpc
315
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
319
316
  end
320
317
  end
321
318
 
@@ -333,10 +330,9 @@ module Google
333
330
  # images.annotate Type
334
331
  #
335
332
  # @example
336
- # require "google/cloud"
333
+ # require "google/cloud/vision"
337
334
  #
338
- # gcloud = Google::Cloud.new
339
- # vision = gcloud.vision
335
+ # vision = Google::Cloud::Vision.new
340
336
  #
341
337
  # image = vision.image "path/to/face.jpg"
342
338
  # face = image.face
@@ -349,13 +345,13 @@ module Google
349
345
  #
350
346
  class Features
351
347
  ##
352
- # @private The FaceAnnotation Google API Client object.
353
- attr_accessor :gapi
348
+ # @private The FaceAnnotation GRPC object.
349
+ attr_accessor :grpc
354
350
 
355
351
  ##
356
352
  # @private Creates a new Features instance.
357
353
  def initialize
358
- @gapi = {}
354
+ @grpc = nil
359
355
  end
360
356
 
361
357
  ##
@@ -364,7 +360,7 @@ module Google
364
360
  # @return [Float] A value in the range [0,1].
365
361
  #
366
362
  def confidence
367
- @gapi.landmarking_confidence
363
+ @grpc.landmarking_confidence
368
364
  end
369
365
 
370
366
  ##
@@ -380,10 +376,9 @@ module Google
380
376
  # @return [Landmark]
381
377
  #
382
378
  # @example
383
- # require "google/cloud"
379
+ # require "google/cloud/vision"
384
380
  #
385
- # gcloud = Google::Cloud.new
386
- # vision = gcloud.vision
381
+ # vision = Google::Cloud::Vision.new
387
382
  #
388
383
  # image = vision.image "path/to/face.jpg"
389
384
  # face = image.face
@@ -392,11 +387,11 @@ module Google
392
387
  # #=> #<Landmark (x: 303.81198, y: 88.5782, z: 77.719193)>
393
388
  #
394
389
  def [] landmark_type
395
- landmark = Array(@gapi.landmarks).detect do |l|
390
+ landmark = Array(@grpc.landmarks).detect do |l|
396
391
  l.type == landmark_type
397
392
  end
398
393
  return nil if landmark.nil?
399
- Landmark.from_gapi landmark
394
+ Landmark.from_grpc landmark
400
395
  end
401
396
 
402
397
  ##
@@ -405,9 +400,9 @@ module Google
405
400
  # @return [Chin]
406
401
  #
407
402
  def chin
408
- @chin ||= Chin.new self["CHIN_LEFT_GONION"],
409
- self["CHIN_GNATHION"],
410
- self["CHIN_RIGHT_GONION"]
403
+ @chin ||= Chin.new self[:CHIN_LEFT_GONION],
404
+ self[:CHIN_GNATHION],
405
+ self[:CHIN_RIGHT_GONION]
411
406
  end
412
407
 
413
408
  ##
@@ -416,8 +411,8 @@ module Google
416
411
  # @return [Ears]
417
412
  #
418
413
  def ears
419
- @ears ||= Ears.new self["LEFT_EAR_TRAGION"],
420
- self["RIGHT_EAR_TRAGION"]
414
+ @ears ||= Ears.new self[:LEFT_EAR_TRAGION],
415
+ self[:RIGHT_EAR_TRAGION]
421
416
  end
422
417
 
423
418
  ##
@@ -427,12 +422,12 @@ module Google
427
422
  #
428
423
  def eyebrows
429
424
  @eyebrows ||= begin
430
- left = Eyebrow.new self["LEFT_OF_LEFT_EYEBROW"],
431
- self["LEFT_EYEBROW_UPPER_MIDPOINT"],
432
- self["RIGHT_OF_LEFT_EYEBROW"]
433
- right = Eyebrow.new self["LEFT_OF_RIGHT_EYEBROW"],
434
- self["RIGHT_EYEBROW_UPPER_MIDPOINT"],
435
- self["RIGHT_OF_RIGHT_EYEBROW"]
425
+ left = Eyebrow.new self[:LEFT_OF_LEFT_EYEBROW],
426
+ self[:LEFT_EYEBROW_UPPER_MIDPOINT],
427
+ self[:RIGHT_OF_LEFT_EYEBROW]
428
+ right = Eyebrow.new self[:LEFT_OF_RIGHT_EYEBROW],
429
+ self[:RIGHT_EYEBROW_UPPER_MIDPOINT],
430
+ self[:RIGHT_OF_RIGHT_EYEBROW]
436
431
  Eyebrows.new left, right
437
432
  end
438
433
  end
@@ -444,16 +439,16 @@ module Google
444
439
  #
445
440
  def eyes
446
441
  @eyes ||= begin
447
- left = Eye.new self["LEFT_EYE_LEFT_CORNER"],
448
- self["LEFT_EYE_BOTTOM_BOUNDARY"],
449
- self["LEFT_EYE"], self["LEFT_EYE_PUPIL"],
450
- self["LEFT_EYE_TOP_BOUNDARY"],
451
- self["LEFT_EYE_RIGHT_CORNER"]
452
- right = Eye.new self["RIGHT_EYE_LEFT_CORNER"],
453
- self["RIGHT_EYE_BOTTOM_BOUNDARY"],
454
- self["RIGHT_EYE"], self["RIGHT_EYE_PUPIL"],
455
- self["RIGHT_EYE_TOP_BOUNDARY"],
456
- self["RIGHT_EYE_RIGHT_CORNER"]
442
+ left = Eye.new self[:LEFT_EYE_LEFT_CORNER],
443
+ self[:LEFT_EYE_BOTTOM_BOUNDARY],
444
+ self[:LEFT_EYE], self[:LEFT_EYE_PUPIL],
445
+ self[:LEFT_EYE_TOP_BOUNDARY],
446
+ self[:LEFT_EYE_RIGHT_CORNER]
447
+ right = Eye.new self[:RIGHT_EYE_LEFT_CORNER],
448
+ self[:RIGHT_EYE_BOTTOM_BOUNDARY],
449
+ self[:RIGHT_EYE], self[:RIGHT_EYE_PUPIL],
450
+ self[:RIGHT_EYE_TOP_BOUNDARY],
451
+ self[:RIGHT_EYE_RIGHT_CORNER]
457
452
  Eyes.new left, right
458
453
  end
459
454
  end
@@ -464,7 +459,7 @@ module Google
464
459
  # @return [Landmark]
465
460
  #
466
461
  def forehead
467
- @forehead ||= self["FOREHEAD_GLABELLA"]
462
+ @forehead ||= self[:FOREHEAD_GLABELLA]
468
463
  end
469
464
 
470
465
  ##
@@ -473,7 +468,7 @@ module Google
473
468
  # @return [Lips]
474
469
  #
475
470
  def lips
476
- @lips ||= Lips.new self["UPPER_LIP"], self["LOWER_LIP"]
471
+ @lips ||= Lips.new self[:UPPER_LIP], self[:LOWER_LIP]
477
472
  end
478
473
 
479
474
  ##
@@ -482,8 +477,8 @@ module Google
482
477
  # @return [Mouth]
483
478
  #
484
479
  def mouth
485
- @mouth ||= Mouth.new self["MOUTH_LEFT"], self["MOUTH_CENTER"],
486
- self["MOUTH_RIGHT"]
480
+ @mouth ||= Mouth.new self[:MOUTH_LEFT], self[:MOUTH_CENTER],
481
+ self[:MOUTH_RIGHT]
487
482
  end
488
483
 
489
484
  ##
@@ -492,10 +487,10 @@ module Google
492
487
  # @return [Nose]
493
488
  #
494
489
  def nose
495
- @nose ||= Nose.new self["NOSE_BOTTOM_LEFT"],
496
- self["NOSE_BOTTOM_CENTER"], self["NOSE_TIP"],
497
- self["MIDPOINT_BETWEEN_EYES"],
498
- self["NOSE_BOTTOM_RIGHT"]
490
+ @nose ||= Nose.new self[:NOSE_BOTTOM_LEFT],
491
+ self[:NOSE_BOTTOM_CENTER], self[:NOSE_TIP],
492
+ self[:MIDPOINT_BETWEEN_EYES],
493
+ self[:NOSE_BOTTOM_RIGHT]
499
494
  end
500
495
 
501
496
  ##
@@ -523,10 +518,10 @@ module Google
523
518
  end
524
519
 
525
520
  ##
526
- # @private New Annotation::Face::Features from a Google API Client
521
+ # @private New Annotation::Face::Features from a GRPC
527
522
  # object.
528
- def self.from_gapi gapi
529
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
523
+ def self.from_grpc grpc
524
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
530
525
  end
531
526
 
532
527
  ##
@@ -540,10 +535,9 @@ module Google
540
535
  # See {Features} and {Face}.
541
536
  #
542
537
  # @example
543
- # require "google/cloud"
538
+ # require "google/cloud/vision"
544
539
  #
545
- # gcloud = Google::Cloud.new
546
- # vision = gcloud.vision
540
+ # vision = Google::Cloud::Vision.new
547
541
  #
548
542
  # image = vision.image "path/to/face.jpg"
549
543
  # face = image.face
@@ -556,13 +550,13 @@ module Google
556
550
  #
557
551
  class Landmark
558
552
  ##
559
- # @private The Landmark Google API Client object.
560
- attr_accessor :gapi
553
+ # @private The Landmark GRPC object.
554
+ attr_accessor :grpc
561
555
 
562
556
  ##
563
557
  # @private Creates a new Landmark instance.
564
558
  def initialize
565
- @gapi = {}
559
+ @grpc = nil
566
560
  end
567
561
 
568
562
  ##
@@ -574,10 +568,9 @@ module Google
574
568
  # @return [String]
575
569
  #
576
570
  # @example
577
- # require "google/cloud"
571
+ # require "google/cloud/vision"
578
572
  #
579
- # gcloud = Google::Cloud.new
580
- # vision = gcloud.vision
573
+ # vision = Google::Cloud::Vision.new
581
574
  #
582
575
  # image = vision.image "path/to/face.jpg"
583
576
  # face = image.face
@@ -585,7 +578,7 @@ module Google
585
578
  # face.features.forehead.type #=> "FOREHEAD_GLABELLA"
586
579
  #
587
580
  def type
588
- @gapi.type
581
+ @grpc.type
589
582
  end
590
583
 
591
584
  ##
@@ -594,8 +587,8 @@ module Google
594
587
  # @return [Float]
595
588
  #
596
589
  def x
597
- return nil unless @gapi.position
598
- @gapi.position.x
590
+ return nil unless @grpc.position
591
+ @grpc.position.x
599
592
  end
600
593
 
601
594
  ##
@@ -604,8 +597,8 @@ module Google
604
597
  # @return [Float]
605
598
  #
606
599
  def y
607
- return nil unless @gapi.position
608
- @gapi.position.y
600
+ return nil unless @grpc.position
601
+ @grpc.position.y
609
602
  end
610
603
 
611
604
  ##
@@ -614,8 +607,8 @@ module Google
614
607
  # @return [Float]
615
608
  #
616
609
  def z
617
- return nil unless @gapi.position
618
- @gapi.position.z
610
+ return nil unless @grpc.position
611
+ @grpc.position.z
619
612
  end
620
613
 
621
614
  ##
@@ -647,10 +640,10 @@ module Google
647
640
  end
648
641
 
649
642
  ##
650
- # @private New Annotation::Face::Features from a Google API Client
643
+ # @private New Annotation::Face::Features from a GRPC
651
644
  # object.
652
- def self.from_gapi gapi
653
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
645
+ def self.from_grpc grpc
646
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
654
647
  end
655
648
  end
656
649
 
@@ -670,10 +663,9 @@ module Google
670
663
  # @attr_reader [Landmark] right The chin, right gonion.
671
664
  #
672
665
  # @example
673
- # require "google/cloud"
666
+ # require "google/cloud/vision"
674
667
  #
675
- # gcloud = Google::Cloud.new
676
- # vision = gcloud.vision
668
+ # vision = Google::Cloud::Vision.new
677
669
  #
678
670
  # image = vision.image "path/to/face.jpg"
679
671
  # face = image.face
@@ -742,10 +734,9 @@ module Google
742
734
  # images.annotate Type
743
735
  #
744
736
  # @example
745
- # require "google/cloud"
737
+ # require "google/cloud/vision"
746
738
  #
747
- # gcloud = Google::Cloud.new
748
- # vision = gcloud.vision
739
+ # vision = Google::Cloud::Vision.new
749
740
  #
750
741
  # image = vision.image "path/to/face.jpg"
751
742
  # face = image.face
@@ -811,10 +802,9 @@ module Google
811
802
  # images.annotate Type
812
803
  #
813
804
  # @example
814
- # require "google/cloud"
805
+ # require "google/cloud/vision"
815
806
  #
816
- # gcloud = Google::Cloud.new
817
- # vision = gcloud.vision
807
+ # vision = Google::Cloud::Vision.new
818
808
  #
819
809
  # image = vision.image "path/to/face.jpg"
820
810
  # face = image.face
@@ -883,10 +873,9 @@ module Google
883
873
  # @attr_reader [Landmark] right The eyebrow, right.
884
874
  #
885
875
  # @example
886
- # require "google/cloud"
876
+ # require "google/cloud/vision"
887
877
  #
888
- # gcloud = Google::Cloud.new
889
- # vision = gcloud.vision
878
+ # vision = Google::Cloud::Vision.new
890
879
  #
891
880
  # image = vision.image "path/to/face.jpg"
892
881
  # face = image.face
@@ -956,10 +945,9 @@ module Google
956
945
  # @attr_reader [Eye] right The right eye.
957
946
  #
958
947
  # @example
959
- # require "google/cloud"
948
+ # require "google/cloud/vision"
960
949
  #
961
- # gcloud = Google::Cloud.new
962
- # vision = gcloud.vision
950
+ # vision = Google::Cloud::Vision.new
963
951
  #
964
952
  # image = vision.image "path/to/face.jpg"
965
953
  # face = image.face
@@ -1031,10 +1019,9 @@ module Google
1031
1019
  # @attr_reader [Landmark] right The eye, right corner.
1032
1020
  #
1033
1021
  # @example
1034
- # require "google/cloud"
1022
+ # require "google/cloud/vision"
1035
1023
  #
1036
- # gcloud = Google::Cloud.new
1037
- # vision = gcloud.vision
1024
+ # vision = Google::Cloud::Vision.new
1038
1025
  #
1039
1026
  # image = vision.image "path/to/face.jpg"
1040
1027
  # face = image.face
@@ -1105,10 +1092,9 @@ module Google
1105
1092
  # @attr_reader [Landmark] bottom The lower lip.
1106
1093
  #
1107
1094
  # @example
1108
- # require "google/cloud"
1095
+ # require "google/cloud/vision"
1109
1096
  #
1110
- # gcloud = Google::Cloud.new
1111
- # vision = gcloud.vision
1097
+ # vision = Google::Cloud::Vision.new
1112
1098
  #
1113
1099
  # image = vision.image "path/to/face.jpg"
1114
1100
  # face = image.face
@@ -1179,10 +1165,9 @@ module Google
1179
1165
  # @attr_reader [Landmark] right TThe mouth, right.
1180
1166
  #
1181
1167
  # @example
1182
- # require "google/cloud"
1168
+ # require "google/cloud/vision"
1183
1169
  #
1184
- # gcloud = Google::Cloud.new
1185
- # vision = gcloud.vision
1170
+ # vision = Google::Cloud::Vision.new
1186
1171
  #
1187
1172
  # image = vision.image "path/to/face.jpg"
1188
1173
  # face = image.face
@@ -1254,10 +1239,9 @@ module Google
1254
1239
  # @attr_reader [Landmark] right The nose, bottom right.
1255
1240
  #
1256
1241
  # @example
1257
- # require "google/cloud"
1242
+ # require "google/cloud/vision"
1258
1243
  #
1259
- # gcloud = Google::Cloud.new
1260
- # vision = gcloud.vision
1244
+ # vision = Google::Cloud::Vision.new
1261
1245
  #
1262
1246
  # image = vision.image "path/to/face.jpg"
1263
1247
  # face = image.face
@@ -1327,10 +1311,9 @@ module Google
1327
1311
  # images.annotate Likelihood
1328
1312
  #
1329
1313
  # @example
1330
- # require "google/cloud"
1314
+ # require "google/cloud/vision"
1331
1315
  #
1332
- # gcloud = Google::Cloud.new
1333
- # vision = gcloud.vision
1316
+ # vision = Google::Cloud::Vision.new
1334
1317
  #
1335
1318
  # image = vision.image "path/to/face.jpg"
1336
1319
  # face = image.face
@@ -1340,23 +1323,23 @@ module Google
1340
1323
  # face.likelihood.sorrow #=> "VERY_UNLIKELY"
1341
1324
  #
1342
1325
  class Likelihood
1343
- POSITIVE_RATINGS = %w(POSSIBLE LIKELY VERY_LIKELY)
1326
+ POSITIVE_RATINGS = %i(POSSIBLE LIKELY VERY_LIKELY)
1344
1327
 
1345
1328
  ##
1346
- # @private The FaceAnnotation Google API Client object.
1347
- attr_accessor :gapi
1329
+ # @private The FaceAnnotation GRPC object.
1330
+ attr_accessor :grpc
1348
1331
 
1349
1332
  ##
1350
1333
  # @private Creates a new Likelihood instance.
1351
1334
  def initialize
1352
- @gapi = {}
1335
+ @grpc = nil
1353
1336
  end
1354
1337
 
1355
1338
  ##
1356
1339
  # Joy likelihood rating. Possible values are `VERY_UNLIKELY`,
1357
1340
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1358
1341
  def joy
1359
- @gapi.joy_likelihood
1342
+ @grpc.joy_likelihood
1360
1343
  end
1361
1344
 
1362
1345
  ##
@@ -1373,7 +1356,7 @@ module Google
1373
1356
  # Sorrow likelihood rating. Possible values are `VERY_UNLIKELY`,
1374
1357
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1375
1358
  def sorrow
1376
- @gapi.sorrow_likelihood
1359
+ @grpc.sorrow_likelihood
1377
1360
  end
1378
1361
 
1379
1362
  ##
@@ -1390,7 +1373,7 @@ module Google
1390
1373
  # Joy likelihood rating. Possible values are `VERY_UNLIKELY`,
1391
1374
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1392
1375
  def anger
1393
- @gapi.anger_likelihood
1376
+ @grpc.anger_likelihood
1394
1377
  end
1395
1378
 
1396
1379
  ##
@@ -1407,7 +1390,7 @@ module Google
1407
1390
  # Surprise likelihood rating. Possible values are `VERY_UNLIKELY`,
1408
1391
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1409
1392
  def surprise
1410
- @gapi.surprise_likelihood
1393
+ @grpc.surprise_likelihood
1411
1394
  end
1412
1395
 
1413
1396
  ##
@@ -1425,7 +1408,7 @@ module Google
1425
1408
  # `VERY_UNLIKELY`, `UNLIKELY`, `POSSIBLE`, `LIKELY`, and
1426
1409
  # `VERY_LIKELY`.
1427
1410
  def under_exposed
1428
- @gapi.under_exposed_likelihood
1411
+ @grpc.under_exposed_likelihood
1429
1412
  end
1430
1413
 
1431
1414
  ##
@@ -1442,7 +1425,7 @@ module Google
1442
1425
  # Blurred likelihood rating. Possible values are `VERY_UNLIKELY`,
1443
1426
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1444
1427
  def blurred
1445
- @gapi.blurred_likelihood
1428
+ @grpc.blurred_likelihood
1446
1429
  end
1447
1430
 
1448
1431
  ##
@@ -1459,7 +1442,7 @@ module Google
1459
1442
  # Headwear likelihood rating. Possible values are `VERY_UNLIKELY`,
1460
1443
  # `UNLIKELY`, `POSSIBLE`, `LIKELY`, and `VERY_LIKELY`.
1461
1444
  def headwear
1462
- @gapi.headwear_likelihood
1445
+ @grpc.headwear_likelihood
1463
1446
  end
1464
1447
 
1465
1448
  ##
@@ -1499,10 +1482,10 @@ module Google
1499
1482
  end
1500
1483
 
1501
1484
  ##
1502
- # @private New Annotation::Face::Likelihood from a Google API Client
1485
+ # @private New Annotation::Face::Likelihood from a GRPC
1503
1486
  # object.
1504
- def self.from_gapi gapi
1505
- new.tap { |f| f.instance_variable_set :@gapi, gapi }
1487
+ def self.from_grpc grpc
1488
+ new.tap { |f| f.instance_variable_set :@grpc, grpc }
1506
1489
  end
1507
1490
  end
1508
1491
  end