google-cloud-retail-v2 0.11.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +1 -1
  3. data/README.md +1 -1
  4. data/lib/google/cloud/retail/v2/catalog_pb.rb +14 -0
  5. data/lib/google/cloud/retail/v2/catalog_service/client.rb +19 -7
  6. data/lib/google/cloud/retail/v2/catalog_service.rb +1 -1
  7. data/lib/google/cloud/retail/v2/completion_service/client.rb +25 -9
  8. data/lib/google/cloud/retail/v2/completion_service/operations.rb +12 -14
  9. data/lib/google/cloud/retail/v2/completion_service.rb +2 -2
  10. data/lib/google/cloud/retail/v2/completion_service_services_pb.rb +3 -3
  11. data/lib/google/cloud/retail/v2/control_service/client.rb +18 -6
  12. data/lib/google/cloud/retail/v2/control_service.rb +1 -1
  13. data/lib/google/cloud/retail/v2/prediction_service/client.rb +21 -8
  14. data/lib/google/cloud/retail/v2/prediction_service.rb +1 -1
  15. data/lib/google/cloud/retail/v2/prediction_service_pb.rb +1 -0
  16. data/lib/google/cloud/retail/v2/product_service/client.rb +90 -68
  17. data/lib/google/cloud/retail/v2/product_service/operations.rb +12 -14
  18. data/lib/google/cloud/retail/v2/product_service.rb +1 -1
  19. data/lib/google/cloud/retail/v2/product_service_services_pb.rb +48 -38
  20. data/lib/google/cloud/retail/v2/search_service/client.rb +22 -10
  21. data/lib/google/cloud/retail/v2/search_service.rb +2 -2
  22. data/lib/google/cloud/retail/v2/search_service_services_pb.rb +2 -2
  23. data/lib/google/cloud/retail/v2/serving_config_pb.rb +7 -0
  24. data/lib/google/cloud/retail/v2/serving_config_service/client.rb +23 -11
  25. data/lib/google/cloud/retail/v2/serving_config_service.rb +1 -1
  26. data/lib/google/cloud/retail/v2/user_event_service/client.rb +51 -24
  27. data/lib/google/cloud/retail/v2/user_event_service/operations.rb +12 -14
  28. data/lib/google/cloud/retail/v2/user_event_service.rb +1 -1
  29. data/lib/google/cloud/retail/v2/user_event_service_pb.rb +6 -0
  30. data/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +8 -8
  31. data/lib/google/cloud/retail/v2/version.rb +1 -1
  32. data/lib/google/cloud/retail/v2.rb +2 -2
  33. data/proto_docs/google/api/client.rb +318 -0
  34. data/proto_docs/google/api/launch_stage.rb +71 -0
  35. data/proto_docs/google/cloud/retail/v2/catalog.rb +51 -13
  36. data/proto_docs/google/cloud/retail/v2/catalog_service.rb +1 -1
  37. data/proto_docs/google/cloud/retail/v2/common.rb +5 -3
  38. data/proto_docs/google/cloud/retail/v2/completion_service.rb +4 -2
  39. data/proto_docs/google/cloud/retail/v2/control.rb +2 -3
  40. data/proto_docs/google/cloud/retail/v2/prediction_service.rb +7 -8
  41. data/proto_docs/google/cloud/retail/v2/product.rb +27 -5
  42. data/proto_docs/google/cloud/retail/v2/search_service.rb +15 -8
  43. data/proto_docs/google/cloud/retail/v2/serving_config.rb +32 -15
  44. data/proto_docs/google/cloud/retail/v2/serving_config_service.rb +5 -5
  45. data/proto_docs/google/cloud/retail/v2/user_event.rb +1 -1
  46. data/proto_docs/google/cloud/retail/v2/user_event_service.rb +24 -8
  47. data/proto_docs/google/rpc/status.rb +4 -2
  48. metadata +29 -7
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/retail/v2/product_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -150,6 +151,12 @@ module Google
150
151
  config.endpoint = @config.endpoint
151
152
  end
152
153
 
154
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
155
+ config.credentials = credentials
156
+ config.quota_project = @quota_project_id
157
+ config.endpoint = @config.endpoint
158
+ end
159
+
153
160
  @product_service_stub = ::Gapic::ServiceStub.new(
154
161
  ::Google::Cloud::Retail::V2::ProductService::Stub,
155
162
  credentials: credentials,
@@ -166,6 +173,13 @@ module Google
166
173
  #
167
174
  attr_reader :operations_client
168
175
 
176
+ ##
177
+ # Get the associated client for mix-in of the Locations.
178
+ #
179
+ # @return [Google::Cloud::Location::Locations::Client]
180
+ #
181
+ attr_reader :location_client
182
+
169
183
  # Service calls
170
184
 
171
185
  ##
@@ -478,13 +492,11 @@ module Google
478
492
  # # Call the list_products method.
479
493
  # result = client.list_products request
480
494
  #
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|
495
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
496
+ # # over elements, and API calls will be issued to fetch pages as needed.
497
+ # result.each do |item|
486
498
  # # Each element is of type ::Google::Cloud::Retail::V2::Product.
487
- # p response
499
+ # p item
488
500
  # end
489
501
  #
490
502
  def list_products request, options = nil
@@ -821,14 +833,14 @@ module Google
821
833
  # # Call the import_products method.
822
834
  # result = client.import_products request
823
835
  #
824
- # # The returned object is of type Gapic::Operation. You can use this
825
- # # object to check the status of an operation, cancel it, or wait
826
- # # for results. Here is how to block until completion:
836
+ # # The returned object is of type Gapic::Operation. You can use it to
837
+ # # check the status of an operation, cancel it, or wait for results.
838
+ # # Here is how to wait for a response.
827
839
  # result.wait_until_done! timeout: 60
828
840
  # if result.response?
829
841
  # p result.response
830
842
  # else
831
- # puts "Error!"
843
+ # puts "No response received."
832
844
  # end
833
845
  #
834
846
  def import_products request, options = nil
@@ -880,9 +892,9 @@ module Google
880
892
  #
881
893
  # This process is asynchronous and does not require the
882
894
  # {::Google::Cloud::Retail::V2::Product Product} to exist before updating
883
- # fulfillment information. If the request is valid, the update will be
884
- # enqueued and processed downstream. As a consequence, when a response is
885
- # returned, updates are not immediately manifested in the
895
+ # fulfillment information. If the request is valid, the update is enqueued
896
+ # and processed downstream. As a consequence, when a response is returned,
897
+ # updates are not immediately manifested in the
886
898
  # {::Google::Cloud::Retail::V2::Product Product} queried by
887
899
  # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}
888
900
  # or
@@ -892,10 +904,10 @@ module Google
892
904
  # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct}
893
905
  # and
894
906
  # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct},
895
- # the specified inventory field value(s) will overwrite any existing value(s)
907
+ # the specified inventory field value(s) overwrite any existing value(s)
896
908
  # while ignoring the last update time for this field. Furthermore, the last
897
- # update time for the specified inventory fields will be overwritten to the
898
- # time of the
909
+ # update times for the specified inventory fields are overwritten by the
910
+ # times of the
899
911
  # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct}
900
912
  # or
901
913
  # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct}
@@ -903,11 +915,11 @@ module Google
903
915
  #
904
916
  # If no inventory fields are set in
905
917
  # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product},
906
- # then any pre-existing inventory information for this product will be used.
918
+ # then any pre-existing inventory information for this product is used.
907
919
  #
908
920
  # If no inventory fields are set in
909
921
  # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask},
910
- # then any existing inventory information will be preserved.
922
+ # then any existing inventory information is preserved.
911
923
  #
912
924
  # Pre-existing inventory information can only be updated with
913
925
  # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory},
@@ -915,15 +927,17 @@ module Google
915
927
  # and
916
928
  # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}.
917
929
  #
918
- # The returned [Operation][]s will be obsolete after 1 day, and
919
- # [GetOperation][] API will return NOT_FOUND afterwards.
930
+ # The returned {::Google::Longrunning::Operation Operation}s is obsolete after
931
+ # one day, and the GetOperation
932
+ # API returns `NOT_FOUND` afterwards.
920
933
  #
921
- # If conflicting updates are issued, the [Operation][]s associated with the
922
- # stale updates will not be marked as [done][Operation.done] until being
923
- # obsolete.
934
+ # If conflicting updates are issued, the
935
+ # {::Google::Longrunning::Operation Operation}s associated with the stale
936
+ # updates are not marked as {::Google::Longrunning::Operation#done done} until
937
+ # they are obsolete.
924
938
  #
925
939
  # This feature is only available for users who have Retail Search enabled.
926
- # Please enable Retail Search on Cloud Console before using this feature.
940
+ # Enable Retail Search on Cloud Console before using this feature.
927
941
  #
928
942
  # @overload set_inventory(request, options = nil)
929
943
  # Pass arguments to `set_inventory` via a request object, either of type
@@ -1039,14 +1053,14 @@ module Google
1039
1053
  # # Call the set_inventory method.
1040
1054
  # result = client.set_inventory request
1041
1055
  #
1042
- # # The returned object is of type Gapic::Operation. You can use this
1043
- # # object to check the status of an operation, cancel it, or wait
1044
- # # for results. Here is how to block until completion:
1056
+ # # The returned object is of type Gapic::Operation. You can use it to
1057
+ # # check the status of an operation, cancel it, or wait for results.
1058
+ # # Here is how to wait for a response.
1045
1059
  # result.wait_until_done! timeout: 60
1046
1060
  # if result.response?
1047
1061
  # p result.response
1048
1062
  # else
1049
- # puts "Error!"
1063
+ # puts "No response received."
1050
1064
  # end
1051
1065
  #
1052
1066
  def set_inventory request, options = nil
@@ -1105,15 +1119,17 @@ module Google
1105
1119
  # or
1106
1120
  # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}.
1107
1121
  #
1108
- # The returned [Operation][]s will be obsolete after 1 day, and
1109
- # [GetOperation][] API will return NOT_FOUND afterwards.
1122
+ # The returned {::Google::Longrunning::Operation Operation}s will be obsolete
1123
+ # after 1 day, and GetOperation
1124
+ # API will return NOT_FOUND afterwards.
1110
1125
  #
1111
- # If conflicting updates are issued, the [Operation][]s associated with the
1112
- # stale updates will not be marked as [done][Operation.done] until being
1113
- # obsolete.
1126
+ # If conflicting updates are issued, the
1127
+ # {::Google::Longrunning::Operation Operation}s associated with the stale
1128
+ # updates will not be marked as {::Google::Longrunning::Operation#done done}
1129
+ # until being obsolete.
1114
1130
  #
1115
1131
  # This feature is only available for users who have Retail Search enabled.
1116
- # Please enable Retail Search on Cloud Console before using this feature.
1132
+ # Enable Retail Search on Cloud Console before using this feature.
1117
1133
  #
1118
1134
  # @overload add_fulfillment_places(request, options = nil)
1119
1135
  # Pass arguments to `add_fulfillment_places` via a request object, either of type
@@ -1207,14 +1223,14 @@ module Google
1207
1223
  # # Call the add_fulfillment_places method.
1208
1224
  # result = client.add_fulfillment_places request
1209
1225
  #
1210
- # # The returned object is of type Gapic::Operation. You can use this
1211
- # # object to check the status of an operation, cancel it, or wait
1212
- # # for results. Here is how to block until completion:
1226
+ # # The returned object is of type Gapic::Operation. You can use it to
1227
+ # # check the status of an operation, cancel it, or wait for results.
1228
+ # # Here is how to wait for a response.
1213
1229
  # result.wait_until_done! timeout: 60
1214
1230
  # if result.response?
1215
1231
  # p result.response
1216
1232
  # else
1217
- # puts "Error!"
1233
+ # puts "No response received."
1218
1234
  # end
1219
1235
  #
1220
1236
  def add_fulfillment_places request, options = nil
@@ -1273,15 +1289,17 @@ module Google
1273
1289
  # or
1274
1290
  # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}.
1275
1291
  #
1276
- # The returned [Operation][]s will be obsolete after 1 day, and
1277
- # [GetOperation][] API will return NOT_FOUND afterwards.
1292
+ # The returned {::Google::Longrunning::Operation Operation}s will be obsolete
1293
+ # after 1 day, and GetOperation
1294
+ # API will return NOT_FOUND afterwards.
1278
1295
  #
1279
- # If conflicting updates are issued, the [Operation][]s associated with the
1280
- # stale updates will not be marked as [done][Operation.done] until being
1281
- # obsolete.
1296
+ # If conflicting updates are issued, the
1297
+ # {::Google::Longrunning::Operation Operation}s associated with the stale
1298
+ # updates will not be marked as {::Google::Longrunning::Operation#done done}
1299
+ # until being obsolete.
1282
1300
  #
1283
1301
  # This feature is only available for users who have Retail Search enabled.
1284
- # Please enable Retail Search on Cloud Console before using this feature.
1302
+ # Enable Retail Search on Cloud Console before using this feature.
1285
1303
  #
1286
1304
  # @overload remove_fulfillment_places(request, options = nil)
1287
1305
  # Pass arguments to `remove_fulfillment_places` via a request object, either of type
@@ -1370,14 +1388,14 @@ module Google
1370
1388
  # # Call the remove_fulfillment_places method.
1371
1389
  # result = client.remove_fulfillment_places request
1372
1390
  #
1373
- # # The returned object is of type Gapic::Operation. You can use this
1374
- # # object to check the status of an operation, cancel it, or wait
1375
- # # for results. Here is how to block until completion:
1391
+ # # The returned object is of type Gapic::Operation. You can use it to
1392
+ # # check the status of an operation, cancel it, or wait for results.
1393
+ # # Here is how to wait for a response.
1376
1394
  # result.wait_until_done! timeout: 60
1377
1395
  # if result.response?
1378
1396
  # p result.response
1379
1397
  # else
1380
- # puts "Error!"
1398
+ # puts "No response received."
1381
1399
  # end
1382
1400
  #
1383
1401
  def remove_fulfillment_places request, options = nil
@@ -1443,15 +1461,17 @@ module Google
1443
1461
  # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct}
1444
1462
  # has no effect on local inventories.
1445
1463
  #
1446
- # The returned [Operation][]s will be obsolete after 1 day, and
1447
- # [GetOperation][] API will return NOT_FOUND afterwards.
1464
+ # The returned {::Google::Longrunning::Operation Operation}s will be obsolete
1465
+ # after 1 day, and GetOperation
1466
+ # API will return NOT_FOUND afterwards.
1448
1467
  #
1449
- # If conflicting updates are issued, the [Operation][]s associated with the
1450
- # stale updates will not be marked as [done][Operation.done] until being
1451
- # obsolete.
1468
+ # If conflicting updates are issued, the
1469
+ # {::Google::Longrunning::Operation Operation}s associated with the stale
1470
+ # updates will not be marked as {::Google::Longrunning::Operation#done done}
1471
+ # until being obsolete.
1452
1472
  #
1453
1473
  # This feature is only available for users who have Retail Search enabled.
1454
- # Please enable Retail Search on Cloud Console before using this feature.
1474
+ # Enable Retail Search on Cloud Console before using this feature.
1455
1475
  #
1456
1476
  # @overload add_local_inventories(request, options = nil)
1457
1477
  # Pass arguments to `add_local_inventories` via a request object, either of type
@@ -1527,14 +1547,14 @@ module Google
1527
1547
  # # Call the add_local_inventories method.
1528
1548
  # result = client.add_local_inventories request
1529
1549
  #
1530
- # # The returned object is of type Gapic::Operation. You can use this
1531
- # # object to check the status of an operation, cancel it, or wait
1532
- # # for results. Here is how to block until completion:
1550
+ # # The returned object is of type Gapic::Operation. You can use it to
1551
+ # # check the status of an operation, cancel it, or wait for results.
1552
+ # # Here is how to wait for a response.
1533
1553
  # result.wait_until_done! timeout: 60
1534
1554
  # if result.response?
1535
1555
  # p result.response
1536
1556
  # else
1537
- # puts "Error!"
1557
+ # puts "No response received."
1538
1558
  # end
1539
1559
  #
1540
1560
  def add_local_inventories request, options = nil
@@ -1598,15 +1618,17 @@ module Google
1598
1618
  # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct}
1599
1619
  # has no effect on local inventories.
1600
1620
  #
1601
- # The returned [Operation][]s will be obsolete after 1 day, and
1602
- # [GetOperation][] API will return NOT_FOUND afterwards.
1621
+ # The returned {::Google::Longrunning::Operation Operation}s will be obsolete
1622
+ # after 1 day, and GetOperation
1623
+ # API will return NOT_FOUND afterwards.
1603
1624
  #
1604
- # If conflicting updates are issued, the [Operation][]s associated with the
1605
- # stale updates will not be marked as [done][Operation.done] until being
1606
- # obsolete.
1625
+ # If conflicting updates are issued, the
1626
+ # {::Google::Longrunning::Operation Operation}s associated with the stale
1627
+ # updates will not be marked as {::Google::Longrunning::Operation#done done}
1628
+ # until being obsolete.
1607
1629
  #
1608
1630
  # This feature is only available for users who have Retail Search enabled.
1609
- # Please enable Retail Search on Cloud Console before using this feature.
1631
+ # Enable Retail Search on Cloud Console before using this feature.
1610
1632
  #
1611
1633
  # @overload remove_local_inventories(request, options = nil)
1612
1634
  # Pass arguments to `remove_local_inventories` via a request object, either of type
@@ -1666,14 +1688,14 @@ module Google
1666
1688
  # # Call the remove_local_inventories method.
1667
1689
  # result = client.remove_local_inventories request
1668
1690
  #
1669
- # # The returned object is of type Gapic::Operation. You can use this
1670
- # # object to check the status of an operation, cancel it, or wait
1671
- # # for results. Here is how to block until completion:
1691
+ # # The returned object is of type Gapic::Operation. You can use it to
1692
+ # # check the status of an operation, cancel it, or wait for results.
1693
+ # # Here is how to wait for a response.
1672
1694
  # result.wait_until_done! timeout: 60
1673
1695
  # if result.response?
1674
1696
  # p result.response
1675
1697
  # else
1676
- # puts "Error!"
1698
+ # puts "No response received."
1677
1699
  # end
1678
1700
  #
1679
1701
  def remove_local_inventories request, options = nil
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -35,7 +35,7 @@ module Google
35
35
  # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information
36
36
  # of the customer's website.
37
37
  #
38
- # To load this service and instantiate a client:
38
+ # @example Load this service and instantiate a gRPC client
39
39
  #
40
40
  # require "google/cloud/retail/v2/product_service"
41
41
  # client = ::Google::Cloud::Retail::V2::ProductService::Client.new
@@ -58,9 +58,9 @@ module Google
58
58
  #
59
59
  # This process is asynchronous and does not require the
60
60
  # [Product][google.cloud.retail.v2.Product] to exist before updating
61
- # fulfillment information. If the request is valid, the update will be
62
- # enqueued and processed downstream. As a consequence, when a response is
63
- # returned, updates are not immediately manifested in the
61
+ # fulfillment information. If the request is valid, the update is enqueued
62
+ # and processed downstream. As a consequence, when a response is returned,
63
+ # updates are not immediately manifested in the
64
64
  # [Product][google.cloud.retail.v2.Product] queried by
65
65
  # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
66
66
  # or
@@ -70,10 +70,10 @@ module Google
70
70
  # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
71
71
  # and
72
72
  # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct],
73
- # the specified inventory field value(s) will overwrite any existing value(s)
73
+ # the specified inventory field value(s) overwrite any existing value(s)
74
74
  # while ignoring the last update time for this field. Furthermore, the last
75
- # update time for the specified inventory fields will be overwritten to the
76
- # time of the
75
+ # update times for the specified inventory fields are overwritten by the
76
+ # times of the
77
77
  # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
78
78
  # or
79
79
  # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
@@ -81,11 +81,11 @@ module Google
81
81
  #
82
82
  # If no inventory fields are set in
83
83
  # [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product],
84
- # then any pre-existing inventory information for this product will be used.
84
+ # then any pre-existing inventory information for this product is used.
85
85
  #
86
86
  # If no inventory fields are set in
87
87
  # [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask],
88
- # then any existing inventory information will be preserved.
88
+ # then any existing inventory information is preserved.
89
89
  #
90
90
  # Pre-existing inventory information can only be updated with
91
91
  # [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory],
@@ -93,15 +93,17 @@ module Google
93
93
  # and
94
94
  # [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces].
95
95
  #
96
- # The returned [Operation][]s will be obsolete after 1 day, and
97
- # [GetOperation][] API will return NOT_FOUND afterwards.
96
+ # The returned [Operation][google.longrunning.Operation]s is obsolete after
97
+ # one day, and the [GetOperation][google.longrunning.Operations.GetOperation]
98
+ # API returns `NOT_FOUND` afterwards.
98
99
  #
99
- # If conflicting updates are issued, the [Operation][]s associated with the
100
- # stale updates will not be marked as [done][Operation.done] until being
101
- # obsolete.
100
+ # If conflicting updates are issued, the
101
+ # [Operation][google.longrunning.Operation]s associated with the stale
102
+ # updates are not marked as [done][google.longrunning.Operation.done] until
103
+ # they are obsolete.
102
104
  #
103
105
  # This feature is only available for users who have Retail Search enabled.
104
- # Please enable Retail Search on Cloud Console before using this feature.
106
+ # Enable Retail Search on Cloud Console before using this feature.
105
107
  rpc :SetInventory, ::Google::Cloud::Retail::V2::SetInventoryRequest, ::Google::Longrunning::Operation
106
108
  # Incrementally adds place IDs to
107
109
  # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids].
@@ -116,15 +118,17 @@ module Google
116
118
  # or
117
119
  # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
118
120
  #
119
- # The returned [Operation][]s will be obsolete after 1 day, and
120
- # [GetOperation][] API will return NOT_FOUND afterwards.
121
+ # The returned [Operation][google.longrunning.Operation]s will be obsolete
122
+ # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation]
123
+ # API will return NOT_FOUND afterwards.
121
124
  #
122
- # If conflicting updates are issued, the [Operation][]s associated with the
123
- # stale updates will not be marked as [done][Operation.done] until being
124
- # obsolete.
125
+ # If conflicting updates are issued, the
126
+ # [Operation][google.longrunning.Operation]s associated with the stale
127
+ # updates will not be marked as [done][google.longrunning.Operation.done]
128
+ # until being obsolete.
125
129
  #
126
130
  # This feature is only available for users who have Retail Search enabled.
127
- # Please enable Retail Search on Cloud Console before using this feature.
131
+ # Enable Retail Search on Cloud Console before using this feature.
128
132
  rpc :AddFulfillmentPlaces, ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Google::Longrunning::Operation
129
133
  # Incrementally removes place IDs from a
130
134
  # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids].
@@ -139,15 +143,17 @@ module Google
139
143
  # or
140
144
  # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
141
145
  #
142
- # The returned [Operation][]s will be obsolete after 1 day, and
143
- # [GetOperation][] API will return NOT_FOUND afterwards.
146
+ # The returned [Operation][google.longrunning.Operation]s will be obsolete
147
+ # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation]
148
+ # API will return NOT_FOUND afterwards.
144
149
  #
145
- # If conflicting updates are issued, the [Operation][]s associated with the
146
- # stale updates will not be marked as [done][Operation.done] until being
147
- # obsolete.
150
+ # If conflicting updates are issued, the
151
+ # [Operation][google.longrunning.Operation]s associated with the stale
152
+ # updates will not be marked as [done][google.longrunning.Operation.done]
153
+ # until being obsolete.
148
154
  #
149
155
  # This feature is only available for users who have Retail Search enabled.
150
- # Please enable Retail Search on Cloud Console before using this feature.
156
+ # Enable Retail Search on Cloud Console before using this feature.
151
157
  rpc :RemoveFulfillmentPlaces, ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Google::Longrunning::Operation
152
158
  # Updates local inventory information for a
153
159
  # [Product][google.cloud.retail.v2.Product] at a list of places, while
@@ -169,15 +175,17 @@ module Google
169
175
  # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
170
176
  # has no effect on local inventories.
171
177
  #
172
- # The returned [Operation][]s will be obsolete after 1 day, and
173
- # [GetOperation][] API will return NOT_FOUND afterwards.
178
+ # The returned [Operation][google.longrunning.Operation]s will be obsolete
179
+ # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation]
180
+ # API will return NOT_FOUND afterwards.
174
181
  #
175
- # If conflicting updates are issued, the [Operation][]s associated with the
176
- # stale updates will not be marked as [done][Operation.done] until being
177
- # obsolete.
182
+ # If conflicting updates are issued, the
183
+ # [Operation][google.longrunning.Operation]s associated with the stale
184
+ # updates will not be marked as [done][google.longrunning.Operation.done]
185
+ # until being obsolete.
178
186
  #
179
187
  # This feature is only available for users who have Retail Search enabled.
180
- # Please enable Retail Search on Cloud Console before using this feature.
188
+ # Enable Retail Search on Cloud Console before using this feature.
181
189
  rpc :AddLocalInventories, ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Google::Longrunning::Operation
182
190
  # Remove local inventory information for a
183
191
  # [Product][google.cloud.retail.v2.Product] at a list of places at a removal
@@ -197,15 +205,17 @@ module Google
197
205
  # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
198
206
  # has no effect on local inventories.
199
207
  #
200
- # The returned [Operation][]s will be obsolete after 1 day, and
201
- # [GetOperation][] API will return NOT_FOUND afterwards.
208
+ # The returned [Operation][google.longrunning.Operation]s will be obsolete
209
+ # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation]
210
+ # API will return NOT_FOUND afterwards.
202
211
  #
203
- # If conflicting updates are issued, the [Operation][]s associated with the
204
- # stale updates will not be marked as [done][Operation.done] until being
205
- # obsolete.
212
+ # If conflicting updates are issued, the
213
+ # [Operation][google.longrunning.Operation]s associated with the stale
214
+ # updates will not be marked as [done][google.longrunning.Operation.done]
215
+ # until being obsolete.
206
216
  #
207
217
  # This feature is only available for users who have Retail Search enabled.
208
- # Please enable Retail Search on Cloud Console before using this feature.
218
+ # Enable Retail Search on Cloud Console before using this feature.
209
219
  rpc :RemoveLocalInventories, ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Google::Longrunning::Operation
210
220
  end
211
221
 
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/retail/v2/search_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -30,7 +31,7 @@ module Google
30
31
  # Service for search.
31
32
  #
32
33
  # This feature is only available for users who have Retail Search enabled.
33
- # Please enable Retail Search on Cloud Console before using this feature.
34
+ # Enable Retail Search on Cloud Console before using this feature.
34
35
  #
35
36
  class Client
36
37
  include Paths
@@ -141,6 +142,12 @@ module Google
141
142
  @quota_project_id = @config.quota_project
142
143
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
143
144
 
145
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
144
151
  @search_service_stub = ::Gapic::ServiceStub.new(
145
152
  ::Google::Cloud::Retail::V2::SearchService::Stub,
146
153
  credentials: credentials,
@@ -150,13 +157,20 @@ module Google
150
157
  )
151
158
  end
152
159
 
160
+ ##
161
+ # Get the associated client for mix-in of the Locations.
162
+ #
163
+ # @return [Google::Cloud::Location::Locations::Client]
164
+ #
165
+ attr_reader :location_client
166
+
153
167
  # Service calls
154
168
 
155
169
  ##
156
170
  # Performs a search.
157
171
  #
158
172
  # This feature is only available for users who have Retail Search enabled.
159
- # Please enable Retail Search on Cloud Console before using this feature.
173
+ # Enable Retail Search on Cloud Console before using this feature.
160
174
  #
161
175
  # @overload search(request, options = nil)
162
176
  # Pass arguments to `search` via a request object, either of type
@@ -178,7 +192,7 @@ module Google
178
192
  # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
179
193
  # or the name of the legacy placement resource, such as
180
194
  # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
181
- # This field is used to identify the serving configuration name and the set
195
+ # This field is used to identify the serving config name and the set
182
196
  # of models that will be used to make the search.
183
197
  # @param branch [::String]
184
198
  # The branch resource name, such as
@@ -363,7 +377,7 @@ module Google
363
377
  # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories};
364
378
  #
365
379
  # To represent full path of category, use '>' sign to separate different
366
- # hierarchies. If '>' is part of the category name, please replace it with
380
+ # hierarchies. If '>' is part of the category name, replace it with
367
381
  # other character(s).
368
382
  #
369
383
  # Category pages include special pages such as sales or promotions. For
@@ -425,13 +439,11 @@ module Google
425
439
  # # Call the search method.
426
440
  # result = client.search request
427
441
  #
428
- # # The returned object is of type Gapic::PagedEnumerable. You can
429
- # # iterate over all elements by calling #each, and the enumerable
430
- # # will lazily make API calls to fetch subsequent pages. Other
431
- # # methods are also available for managing paging directly.
432
- # result.each do |response|
442
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
443
+ # # over elements, and API calls will be issued to fetch pages as needed.
444
+ # result.each do |item|
433
445
  # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult.
434
- # p response
446
+ # p item
435
447
  # end
436
448
  #
437
449
  def search request, options = nil