google-cloud-retail-v2 0.6.0 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,6 +146,7 @@ module Google
146
146
 
147
147
  @operations_client = Operations.new do |config|
148
148
  config.credentials = credentials
149
+ config.quota_project = @quota_project_id
149
150
  config.endpoint = @config.endpoint
150
151
  end
151
152
 
@@ -215,6 +216,21 @@ module Google
215
216
  #
216
217
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
218
  #
219
+ # @example Basic example
220
+ # require "google/cloud/retail/v2"
221
+ #
222
+ # # Create a client object. The client can be reused for multiple calls.
223
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
224
+ #
225
+ # # Create a request. To set request fields, pass in keyword arguments.
226
+ # request = Google::Cloud::Retail::V2::CreateProductRequest.new
227
+ #
228
+ # # Call the create_product method.
229
+ # result = client.create_product request
230
+ #
231
+ # # The returned object is of type Google::Cloud::Retail::V2::Product.
232
+ # p result
233
+ #
218
234
  def create_product request, options = nil
219
235
  raise ::ArgumentError, "request must be provided" if request.nil?
220
236
 
@@ -232,9 +248,11 @@ module Google
232
248
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
233
249
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
250
 
235
- header_params = {
236
- "parent" => request.parent
237
- }
251
+ header_params = {}
252
+ if request.parent
253
+ header_params["parent"] = request.parent
254
+ end
255
+
238
256
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
257
  metadata[:"x-goog-request-params"] ||= request_params_header
240
258
 
@@ -292,6 +310,21 @@ module Google
292
310
  #
293
311
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
294
312
  #
313
+ # @example Basic example
314
+ # require "google/cloud/retail/v2"
315
+ #
316
+ # # Create a client object. The client can be reused for multiple calls.
317
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
318
+ #
319
+ # # Create a request. To set request fields, pass in keyword arguments.
320
+ # request = Google::Cloud::Retail::V2::GetProductRequest.new
321
+ #
322
+ # # Call the get_product method.
323
+ # result = client.get_product request
324
+ #
325
+ # # The returned object is of type Google::Cloud::Retail::V2::Product.
326
+ # p result
327
+ #
295
328
  def get_product request, options = nil
296
329
  raise ::ArgumentError, "request must be provided" if request.nil?
297
330
 
@@ -309,9 +342,11 @@ module Google
309
342
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
310
343
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
344
 
312
- header_params = {
313
- "name" => request.name
314
- }
345
+ header_params = {}
346
+ if request.name
347
+ header_params["name"] = request.name
348
+ end
349
+
315
350
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
316
351
  metadata[:"x-goog-request-params"] ||= request_params_header
317
352
 
@@ -431,6 +466,27 @@ module Google
431
466
  #
432
467
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
433
468
  #
469
+ # @example Basic example
470
+ # require "google/cloud/retail/v2"
471
+ #
472
+ # # Create a client object. The client can be reused for multiple calls.
473
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
474
+ #
475
+ # # Create a request. To set request fields, pass in keyword arguments.
476
+ # request = Google::Cloud::Retail::V2::ListProductsRequest.new
477
+ #
478
+ # # Call the list_products method.
479
+ # result = client.list_products request
480
+ #
481
+ # # The returned object is of type Gapic::PagedEnumerable. You can
482
+ # # iterate over all elements by calling #each, and the enumerable
483
+ # # will lazily make API calls to fetch subsequent pages. Other
484
+ # # methods are also available for managing paging directly.
485
+ # result.each do |response|
486
+ # # Each element is of type ::Google::Cloud::Retail::V2::Product.
487
+ # p response
488
+ # end
489
+ #
434
490
  def list_products request, options = nil
435
491
  raise ::ArgumentError, "request must be provided" if request.nil?
436
492
 
@@ -448,9 +504,11 @@ module Google
448
504
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
449
505
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
450
506
 
451
- header_params = {
452
- "parent" => request.parent
453
- }
507
+ header_params = {}
508
+ if request.parent
509
+ header_params["parent"] = request.parent
510
+ end
511
+
454
512
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
455
513
  metadata[:"x-goog-request-params"] ||= request_params_header
456
514
 
@@ -521,6 +579,21 @@ module Google
521
579
  #
522
580
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
523
581
  #
582
+ # @example Basic example
583
+ # require "google/cloud/retail/v2"
584
+ #
585
+ # # Create a client object. The client can be reused for multiple calls.
586
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
587
+ #
588
+ # # Create a request. To set request fields, pass in keyword arguments.
589
+ # request = Google::Cloud::Retail::V2::UpdateProductRequest.new
590
+ #
591
+ # # Call the update_product method.
592
+ # result = client.update_product request
593
+ #
594
+ # # The returned object is of type Google::Cloud::Retail::V2::Product.
595
+ # p result
596
+ #
524
597
  def update_product request, options = nil
525
598
  raise ::ArgumentError, "request must be provided" if request.nil?
526
599
 
@@ -538,9 +611,11 @@ module Google
538
611
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
539
612
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
540
613
 
541
- header_params = {
542
- "product.name" => request.product.name
543
- }
614
+ header_params = {}
615
+ if request.product&.name
616
+ header_params["product.name"] = request.product.name
617
+ end
618
+
544
619
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
545
620
  metadata[:"x-goog-request-params"] ||= request_params_header
546
621
 
@@ -609,6 +684,21 @@ module Google
609
684
  #
610
685
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
611
686
  #
687
+ # @example Basic example
688
+ # require "google/cloud/retail/v2"
689
+ #
690
+ # # Create a client object. The client can be reused for multiple calls.
691
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
692
+ #
693
+ # # Create a request. To set request fields, pass in keyword arguments.
694
+ # request = Google::Cloud::Retail::V2::DeleteProductRequest.new
695
+ #
696
+ # # Call the delete_product method.
697
+ # result = client.delete_product request
698
+ #
699
+ # # The returned object is of type Google::Protobuf::Empty.
700
+ # p result
701
+ #
612
702
  def delete_product request, options = nil
613
703
  raise ::ArgumentError, "request must be provided" if request.nil?
614
704
 
@@ -626,9 +716,11 @@ module Google
626
716
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
627
717
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
628
718
 
629
- header_params = {
630
- "name" => request.name
631
- }
719
+ header_params = {}
720
+ if request.name
721
+ header_params["name"] = request.name
722
+ end
723
+
632
724
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
633
725
  metadata[:"x-goog-request-params"] ||= request_params_header
634
726
 
@@ -682,7 +774,7 @@ module Google
682
774
  # Unique identifier provided by client, within the ancestor
683
775
  # dataset scope. Ensures idempotency and used for request deduplication.
684
776
  # Server-generated if unspecified. Up to 128 characters long and must match
685
- # the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in
777
+ # the pattern: `[a-zA-Z0-9_]+`. This is returned as [Operation.name][] in
686
778
  # {::Google::Cloud::Retail::V2::ImportMetadata ImportMetadata}.
687
779
  #
688
780
  # Only supported when
@@ -718,6 +810,28 @@ module Google
718
810
  #
719
811
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
720
812
  #
813
+ # @example Basic example
814
+ # require "google/cloud/retail/v2"
815
+ #
816
+ # # Create a client object. The client can be reused for multiple calls.
817
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
818
+ #
819
+ # # Create a request. To set request fields, pass in keyword arguments.
820
+ # request = Google::Cloud::Retail::V2::ImportProductsRequest.new
821
+ #
822
+ # # Call the import_products method.
823
+ # result = client.import_products request
824
+ #
825
+ # # The returned object is of type Gapic::Operation. You can use this
826
+ # # object to check the status of an operation, cancel it, or wait
827
+ # # for results. Here is how to block until completion:
828
+ # result.wait_until_done! timeout: 60
829
+ # if result.response?
830
+ # p result.response
831
+ # else
832
+ # puts "Error!"
833
+ # end
834
+ #
721
835
  def import_products request, options = nil
722
836
  raise ::ArgumentError, "request must be provided" if request.nil?
723
837
 
@@ -735,9 +849,11 @@ module Google
735
849
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
736
850
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
737
851
 
738
- header_params = {
739
- "parent" => request.parent
740
- }
852
+ header_params = {}
853
+ if request.parent
854
+ header_params["parent"] = request.parent
855
+ end
856
+
741
857
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
742
858
  metadata[:"x-goog-request-params"] ||= request_params_header
743
859
 
@@ -878,6 +994,28 @@ module Google
878
994
  #
879
995
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
880
996
  #
997
+ # @example Basic example
998
+ # require "google/cloud/retail/v2"
999
+ #
1000
+ # # Create a client object. The client can be reused for multiple calls.
1001
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
1002
+ #
1003
+ # # Create a request. To set request fields, pass in keyword arguments.
1004
+ # request = Google::Cloud::Retail::V2::SetInventoryRequest.new
1005
+ #
1006
+ # # Call the set_inventory method.
1007
+ # result = client.set_inventory request
1008
+ #
1009
+ # # The returned object is of type Gapic::Operation. You can use this
1010
+ # # object to check the status of an operation, cancel it, or wait
1011
+ # # for results. Here is how to block until completion:
1012
+ # result.wait_until_done! timeout: 60
1013
+ # if result.response?
1014
+ # p result.response
1015
+ # else
1016
+ # puts "Error!"
1017
+ # end
1018
+ #
881
1019
  def set_inventory request, options = nil
882
1020
  raise ::ArgumentError, "request must be provided" if request.nil?
883
1021
 
@@ -895,9 +1033,11 @@ module Google
895
1033
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
896
1034
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
897
1035
 
898
- header_params = {
899
- "inventory.name" => request.inventory.name
900
- }
1036
+ header_params = {}
1037
+ if request.inventory&.name
1038
+ header_params["inventory.name"] = request.inventory.name
1039
+ end
1040
+
901
1041
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
902
1042
  metadata[:"x-goog-request-params"] ||= request_params_header
903
1043
 
@@ -988,7 +1128,7 @@ module Google
988
1128
  #
989
1129
  # At least 1 value is required, and a maximum of 2000 values are allowed.
990
1130
  # Each value must be a string with a length limit of 10 characters, matching
991
- # the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
1131
+ # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
992
1132
  # INVALID_ARGUMENT error is returned.
993
1133
  #
994
1134
  # If the total number of place IDs exceeds 2000 for this
@@ -1014,6 +1154,28 @@ module Google
1014
1154
  #
1015
1155
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1016
1156
  #
1157
+ # @example Basic example
1158
+ # require "google/cloud/retail/v2"
1159
+ #
1160
+ # # Create a client object. The client can be reused for multiple calls.
1161
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
1162
+ #
1163
+ # # Create a request. To set request fields, pass in keyword arguments.
1164
+ # request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new
1165
+ #
1166
+ # # Call the add_fulfillment_places method.
1167
+ # result = client.add_fulfillment_places request
1168
+ #
1169
+ # # The returned object is of type Gapic::Operation. You can use this
1170
+ # # object to check the status of an operation, cancel it, or wait
1171
+ # # for results. Here is how to block until completion:
1172
+ # result.wait_until_done! timeout: 60
1173
+ # if result.response?
1174
+ # p result.response
1175
+ # else
1176
+ # puts "Error!"
1177
+ # end
1178
+ #
1017
1179
  def add_fulfillment_places request, options = nil
1018
1180
  raise ::ArgumentError, "request must be provided" if request.nil?
1019
1181
 
@@ -1031,9 +1193,11 @@ module Google
1031
1193
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
1032
1194
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1033
1195
 
1034
- header_params = {
1035
- "product" => request.product
1036
- }
1196
+ header_params = {}
1197
+ if request.product
1198
+ header_params["product"] = request.product
1199
+ end
1200
+
1037
1201
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1038
1202
  metadata[:"x-goog-request-params"] ||= request_params_header
1039
1203
 
@@ -1123,7 +1287,7 @@ module Google
1123
1287
  #
1124
1288
  # At least 1 value is required, and a maximum of 2000 values are allowed.
1125
1289
  # Each value must be a string with a length limit of 10 characters, matching
1126
- # the pattern [a-zA-Z0-9_-]+, such as "store1" or "REGION-2". Otherwise, an
1290
+ # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
1127
1291
  # INVALID_ARGUMENT error is returned.
1128
1292
  # @param remove_time [::Google::Protobuf::Timestamp, ::Hash]
1129
1293
  # The time when the fulfillment updates are issued, used to prevent
@@ -1145,6 +1309,28 @@ module Google
1145
1309
  #
1146
1310
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1147
1311
  #
1312
+ # @example Basic example
1313
+ # require "google/cloud/retail/v2"
1314
+ #
1315
+ # # Create a client object. The client can be reused for multiple calls.
1316
+ # client = Google::Cloud::Retail::V2::ProductService::Client.new
1317
+ #
1318
+ # # Create a request. To set request fields, pass in keyword arguments.
1319
+ # request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new
1320
+ #
1321
+ # # Call the remove_fulfillment_places method.
1322
+ # result = client.remove_fulfillment_places request
1323
+ #
1324
+ # # The returned object is of type Gapic::Operation. You can use this
1325
+ # # object to check the status of an operation, cancel it, or wait
1326
+ # # for results. Here is how to block until completion:
1327
+ # result.wait_until_done! timeout: 60
1328
+ # if result.response?
1329
+ # p result.response
1330
+ # else
1331
+ # puts "Error!"
1332
+ # end
1333
+ #
1148
1334
  def remove_fulfillment_places request, options = nil
1149
1335
  raise ::ArgumentError, "request must be provided" if request.nil?
1150
1336
 
@@ -1162,9 +1348,11 @@ module Google
1162
1348
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
1163
1349
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1164
1350
 
1165
- header_params = {
1166
- "product" => request.product
1167
- }
1351
+ header_params = {}
1352
+ if request.product
1353
+ header_params["product"] = request.product
1354
+ end
1355
+
1168
1356
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1169
1357
  metadata[:"x-goog-request-params"] ||= request_params_header
1170
1358
 
@@ -143,6 +143,27 @@ module Google
143
143
  #
144
144
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
145
  #
146
+ # @example Basic example
147
+ # require "google/longrunning"
148
+ #
149
+ # # Create a client object. The client can be reused for multiple calls.
150
+ # client = Google::Longrunning::Operations::Client.new
151
+ #
152
+ # # Create a request. To set request fields, pass in keyword arguments.
153
+ # request = Google::Longrunning::ListOperationsRequest.new
154
+ #
155
+ # # Call the list_operations method.
156
+ # result = client.list_operations request
157
+ #
158
+ # # The returned object is of type Gapic::PagedEnumerable. You can
159
+ # # iterate over all elements by calling #each, and the enumerable
160
+ # # will lazily make API calls to fetch subsequent pages. Other
161
+ # # methods are also available for managing paging directly.
162
+ # result.each do |response|
163
+ # # Each element is of type ::Google::Longrunning::Operation.
164
+ # p response
165
+ # end
166
+ #
146
167
  def list_operations request, options = nil
147
168
  raise ::ArgumentError, "request must be provided" if request.nil?
148
169
 
@@ -160,9 +181,11 @@ module Google
160
181
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
161
182
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
183
 
163
- header_params = {
164
- "name" => request.name
165
- }
184
+ header_params = {}
185
+ if request.name
186
+ header_params["name"] = request.name
187
+ end
188
+
166
189
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
190
  metadata[:"x-goog-request-params"] ||= request_params_header
168
191
 
@@ -215,6 +238,28 @@ module Google
215
238
  #
216
239
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
240
  #
241
+ # @example Basic example
242
+ # require "google/longrunning"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Longrunning::Operations::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Longrunning::GetOperationRequest.new
249
+ #
250
+ # # Call the get_operation method.
251
+ # result = client.get_operation request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use this
254
+ # # object to check the status of an operation, cancel it, or wait
255
+ # # for results. Here is how to block until completion:
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "Error!"
261
+ # end
262
+ #
218
263
  def get_operation request, options = nil
219
264
  raise ::ArgumentError, "request must be provided" if request.nil?
220
265
 
@@ -232,9 +277,11 @@ module Google
232
277
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
233
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
279
 
235
- header_params = {
236
- "name" => request.name
237
- }
280
+ header_params = {}
281
+ if request.name
282
+ header_params["name"] = request.name
283
+ end
284
+
238
285
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
286
  metadata[:"x-goog-request-params"] ||= request_params_header
240
287
 
@@ -287,6 +334,21 @@ module Google
287
334
  #
288
335
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
336
  #
337
+ # @example Basic example
338
+ # require "google/longrunning"
339
+ #
340
+ # # Create a client object. The client can be reused for multiple calls.
341
+ # client = Google::Longrunning::Operations::Client.new
342
+ #
343
+ # # Create a request. To set request fields, pass in keyword arguments.
344
+ # request = Google::Longrunning::DeleteOperationRequest.new
345
+ #
346
+ # # Call the delete_operation method.
347
+ # result = client.delete_operation request
348
+ #
349
+ # # The returned object is of type Google::Protobuf::Empty.
350
+ # p result
351
+ #
290
352
  def delete_operation request, options = nil
291
353
  raise ::ArgumentError, "request must be provided" if request.nil?
292
354
 
@@ -304,9 +366,11 @@ module Google
304
366
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
305
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
368
 
307
- header_params = {
308
- "name" => request.name
309
- }
369
+ header_params = {}
370
+ if request.name
371
+ header_params["name"] = request.name
372
+ end
373
+
310
374
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
375
  metadata[:"x-goog-request-params"] ||= request_params_header
312
376
 
@@ -364,6 +428,21 @@ module Google
364
428
  #
365
429
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
430
  #
431
+ # @example Basic example
432
+ # require "google/longrunning"
433
+ #
434
+ # # Create a client object. The client can be reused for multiple calls.
435
+ # client = Google::Longrunning::Operations::Client.new
436
+ #
437
+ # # Create a request. To set request fields, pass in keyword arguments.
438
+ # request = Google::Longrunning::CancelOperationRequest.new
439
+ #
440
+ # # Call the cancel_operation method.
441
+ # result = client.cancel_operation request
442
+ #
443
+ # # The returned object is of type Google::Protobuf::Empty.
444
+ # p result
445
+ #
367
446
  def cancel_operation request, options = nil
368
447
  raise ::ArgumentError, "request must be provided" if request.nil?
369
448
 
@@ -381,9 +460,11 @@ module Google
381
460
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
382
461
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
462
 
384
- header_params = {
385
- "name" => request.name
386
- }
463
+ header_params = {}
464
+ if request.name
465
+ header_params["name"] = request.name
466
+ end
467
+
387
468
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
388
469
  metadata[:"x-goog-request-params"] ||= request_params_header
389
470
 
@@ -444,6 +525,28 @@ module Google
444
525
  #
445
526
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
527
  #
528
+ # @example Basic example
529
+ # require "google/longrunning"
530
+ #
531
+ # # Create a client object. The client can be reused for multiple calls.
532
+ # client = Google::Longrunning::Operations::Client.new
533
+ #
534
+ # # Create a request. To set request fields, pass in keyword arguments.
535
+ # request = Google::Longrunning::WaitOperationRequest.new
536
+ #
537
+ # # Call the wait_operation method.
538
+ # result = client.wait_operation request
539
+ #
540
+ # # The returned object is of type Gapic::Operation. You can use this
541
+ # # object to check the status of an operation, cancel it, or wait
542
+ # # for results. Here is how to block until completion:
543
+ # result.wait_until_done! timeout: 60
544
+ # if result.response?
545
+ # p result.response
546
+ # else
547
+ # puts "Error!"
548
+ # end
549
+ #
447
550
  def wait_operation request, options = nil
448
551
  raise ::ArgumentError, "request must be provided" if request.nil?
449
552
 
@@ -293,7 +293,10 @@ module Google
293
293
  # * price
294
294
  # * originalPrice
295
295
  # * discount
296
+ # * variantId
296
297
  # * inventory(place_id,price)
298
+ # * inventory(place_id,attributes.key), where key is any key in the
299
+ # [Product.inventories.attributes][] map.
297
300
  # * attributes.key, where key is any key in the
298
301
  # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map.
299
302
  # * pickupInStore.id, where id is any
@@ -360,6 +363,27 @@ module Google
360
363
  #
361
364
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
362
365
  #
366
+ # @example Basic example
367
+ # require "google/cloud/retail/v2"
368
+ #
369
+ # # Create a client object. The client can be reused for multiple calls.
370
+ # client = Google::Cloud::Retail::V2::SearchService::Client.new
371
+ #
372
+ # # Create a request. To set request fields, pass in keyword arguments.
373
+ # request = Google::Cloud::Retail::V2::SearchRequest.new
374
+ #
375
+ # # Call the search method.
376
+ # result = client.search request
377
+ #
378
+ # # The returned object is of type Gapic::PagedEnumerable. You can
379
+ # # iterate over all elements by calling #each, and the enumerable
380
+ # # will lazily make API calls to fetch subsequent pages. Other
381
+ # # methods are also available for managing paging directly.
382
+ # result.each do |response|
383
+ # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult.
384
+ # p response
385
+ # end
386
+ #
363
387
  def search request, options = nil
364
388
  raise ::ArgumentError, "request must be provided" if request.nil?
365
389
 
@@ -377,9 +401,11 @@ module Google
377
401
  gapic_version: ::Google::Cloud::Retail::V2::VERSION
378
402
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
379
403
 
380
- header_params = {
381
- "placement" => request.placement
382
- }
404
+ header_params = {}
405
+ if request.placement
406
+ header_params["placement"] = request.placement
407
+ end
408
+
383
409
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
384
410
  metadata[:"x-goog-request-params"] ||= request_params_header
385
411