Class: Google::Cloud::Retail::V2::ProductService::Rest::Client
- Inherits:
-
Object
- Object
- Google::Cloud::Retail::V2::ProductService::Rest::Client
- Includes:
- Paths
- Defined in:
- lib/google/cloud/retail/v2/product_service/rest/client.rb
Overview
REST client for the ProductService service.
Service for ingesting Product information of the customer's website.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary collapse
-
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client
readonly
Get the associated client for mix-in of the Locations.
-
#operations_client ⇒ ::Google::Cloud::Retail::V2::ProductService::Rest::Operations
readonly
Get the associated client for long-running operations.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ Client::Configuration
Configure the ProductService Client class.
Instance Method Summary collapse
-
#add_fulfillment_places(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
We recommend that you use the ProductService.AddLocalInventories method instead of the ProductService.AddFulfillmentPlaces method.
-
#add_local_inventories(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
-
#configure {|config| ... } ⇒ Client::Configuration
Configure the ProductService Client instance.
-
#create_product(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Retail::V2::Product
Creates a Product.
-
#delete_product(request, options = nil) {|result, operation| ... } ⇒ ::Google::Protobuf::Empty
Deletes a Product.
-
#get_product(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Retail::V2::Product
Gets a Product.
-
#import_products(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Bulk import of multiple Products.
-
#initialize {|config| ... } ⇒ Client
constructor
Create a new ProductService REST client object.
-
#list_products(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
Gets a list of Products.
-
#logger ⇒ Logger
The logger used for request/response debug logging.
-
#purge_products(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Permanently deletes all selected Products under a branch.
-
#remove_fulfillment_places(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
We recommend that you use the ProductService.RemoveLocalInventories method instead of the ProductService.RemoveFulfillmentPlaces method.
-
#remove_local_inventories(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Remove local inventory information for a Product at a list of places at a removal timestamp.
-
#set_inventory(request, options = nil) {|result, operation| ... } ⇒ ::Gapic::Operation
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
-
#universe_domain ⇒ String
The effective universe domain.
-
#update_product(request, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::Retail::V2::Product
Updates a Product.
Methods included from Paths
Constructor Details
#initialize {|config| ... } ⇒ Client
Create a new ProductService REST client object.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 138 def initialize # Create the configuration object @config = Configuration.new Client.configure # Yield the configuration if needed yield @config if block_given? # Create credentials credentials = @config.credentials # Use self-signed JWT if the endpoint is unchanged from default, # but only if the default endpoint does not have a region prefix. enable_self_signed_jwt = @config.endpoint.nil? || (@config.endpoint == Configuration::DEFAULT_ENDPOINT && !@config.endpoint.split(".").first.include?("-")) credentials ||= Credentials.default scope: @config.scope, enable_self_signed_jwt: enable_self_signed_jwt if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end @quota_project_id = @config.quota_project @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id @operations_client = ::Google::Cloud::Retail::V2::ProductService::Rest::Operations.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @config.endpoint config.universe_domain = @config.universe_domain end @product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, credentials: credentials, logger: @config.logger ) @product_service_stub.logger(stub: true)&.info do |entry| entry.set_system_name entry.set_service entry. = "Created client for #{entry.service}" entry.set_credentials_fields credentials entry.set "customEndpoint", @config.endpoint if @config.endpoint entry.set "defaultTimeout", @config.timeout if @config.timeout entry.set "quotaProject", @quota_project_id if @quota_project_id end @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @product_service_stub.endpoint config.universe_domain = @product_service_stub.universe_domain config.logger = @product_service_stub.logger if config.respond_to? :logger= end end |
Instance Attribute Details
#location_client ⇒ Google::Cloud::Location::Locations::Rest::Client (readonly)
Get the associated client for mix-in of the Locations.
207 208 209 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 207 def location_client @location_client end |
#operations_client ⇒ ::Google::Cloud::Retail::V2::ProductService::Rest::Operations (readonly)
Get the associated client for long-running operations.
200 201 202 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 200 def operations_client @operations_client end |
Class Method Details
.configure {|config| ... } ⇒ Client::Configuration
Configure the ProductService Client class.
See Configuration for a description of the configuration fields.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 66 def self.configure @configure ||= begin namespace = ["Google", "Cloud", "Retail", "V2"] parent_config = while namespace.any? parent_name = namespace.join "::" parent_const = const_get parent_name break parent_const.configure if parent_const.respond_to? :configure namespace.pop end default_config = Client::Configuration.new parent_config default_config.timeout = 30.0 default_config.retry_policy = { initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] } default_config.rpcs.import_products.timeout = 300.0 default_config.rpcs.import_products.retry_policy = { initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] } default_config end yield @configure if block_given? @configure end |
Instance Method Details
#add_fulfillment_places(request, options = nil) ⇒ ::Gapic::Operation #add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) ⇒ ::Gapic::Operation
We recommend that you use the ProductService.AddLocalInventories method instead of the ProductService.AddFulfillmentPlaces method. ProductService.AddLocalInventories achieves the same results but provides more fine-grained control over ingesting local inventory data.
Incrementally adds place IDs to Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
The returned Operations will be obsolete after 1 day, and GetOperation API will return NOT_FOUND afterwards.
If conflicting updates are issued, the Operations associated with the stale updates will not be marked as done until being obsolete.
1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1382 def add_fulfillment_places request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.add_fulfillment_places..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout, metadata: , retry_policy: @config.rpcs.add_fulfillment_places.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.add_fulfillment_places request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#add_local_inventories(request, options = nil) ⇒ ::Gapic::Operation #add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) ⇒ ::Gapic::Operation
Updates local inventory information for a Product at a list of places, while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be modified using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
The returned Operations will be obsolete after 1 day, and GetOperation API will return NOT_FOUND afterwards.
If conflicting updates are issued, the Operations associated with the stale updates will not be marked as done until being obsolete.
1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1697 def add_local_inventories request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.add_local_inventories..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.add_local_inventories.timeout, metadata: , retry_policy: @config.rpcs.add_local_inventories.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.add_local_inventories request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#configure {|config| ... } ⇒ Client::Configuration
Configure the ProductService Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.
See Configuration for a description of the configuration fields.
108 109 110 111 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 108 def configure yield @config if block_given? @config end |
#create_product(request, options = nil) ⇒ ::Google::Cloud::Retail::V2::Product #create_product(parent: nil, product: nil, product_id: nil) ⇒ ::Google::Cloud::Retail::V2::Product
Creates a Product.
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 282 def create_product request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.create_product..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.create_product.timeout, metadata: , retry_policy: @config.rpcs.create_product.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.create_product request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#delete_product(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_product(name: nil) ⇒ ::Google::Protobuf::Empty
Deletes a Product.
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 726 def delete_product request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.delete_product..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.delete_product.timeout, metadata: , retry_policy: @config.rpcs.delete_product.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.delete_product request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#get_product(request, options = nil) ⇒ ::Google::Cloud::Retail::V2::Product #get_product(name: nil) ⇒ ::Google::Cloud::Retail::V2::Product
Gets a Product.
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 369 def get_product request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.get_product..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.get_product.timeout, metadata: , retry_policy: @config.rpcs.get_product.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.get_product request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#import_products(request, options = nil) ⇒ ::Gapic::Operation #import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil) ⇒ ::Gapic::Operation
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1001 def import_products request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.import_products..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.import_products.timeout, metadata: , retry_policy: @config.rpcs.import_products.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.import_products request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#list_products(request, options = nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product> #list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) ⇒ ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
Gets a list of Products.
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 522 def list_products request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.list_products..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.list_products.timeout, metadata: , retry_policy: @config.rpcs.list_products.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.list_products request, do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @product_service_stub, :list_products, "products", request, result, yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#logger ⇒ Logger
The logger used for request/response debug logging.
214 215 216 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 214 def logger @product_service_stub.logger end |
#purge_products(request, options = nil) ⇒ ::Gapic::Operation #purge_products(parent: nil, filter: nil, force: nil) ⇒ ::Gapic::Operation
Permanently deletes all selected Products under a branch.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of Products, this operation could take hours to complete. Before the operation completes, some Products may still be returned by ProductService.GetProduct or ProductService.ListProducts.
Depending on the number of Products, this operation could take hours to complete. To get a sample of Products that would be deleted, set PurgeProductsRequest.force to false.
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 873 def purge_products request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeProductsRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.purge_products..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.purge_products.timeout, metadata: , retry_policy: @config.rpcs.purge_products.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.purge_products request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#remove_fulfillment_places(request, options = nil) ⇒ ::Gapic::Operation #remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) ⇒ ::Gapic::Operation
We recommend that you use the ProductService.RemoveLocalInventories method instead of the ProductService.RemoveFulfillmentPlaces method. ProductService.RemoveLocalInventories achieves the same results but provides more fine-grained control over ingesting local inventory data.
Incrementally removes place IDs from a Product.fulfillment_info.place_ids.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
The returned Operations will be obsolete after 1 day, and GetOperation API will return NOT_FOUND afterwards.
If conflicting updates are issued, the Operations associated with the stale updates will not be marked as done until being obsolete.
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1547 def remove_fulfillment_places request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.remove_fulfillment_places..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout, metadata: , retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.remove_fulfillment_places request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#remove_local_inventories(request, options = nil) ⇒ ::Gapic::Operation #remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) ⇒ ::Gapic::Operation
Remove local inventory information for a Product at a list of places at a removal timestamp.
This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
Local inventory information can only be removed using this method. ProductService.CreateProduct and ProductService.UpdateProduct has no effect on local inventories.
The returned Operations will be obsolete after 1 day, and GetOperation API will return NOT_FOUND afterwards.
If conflicting updates are issued, the Operations associated with the stale updates will not be marked as done until being obsolete.
1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1829 def remove_local_inventories request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.remove_local_inventories..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout, metadata: , retry_policy: @config.rpcs.remove_local_inventories.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.remove_local_inventories request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#set_inventory(request, options = nil) ⇒ ::Gapic::Operation #set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) ⇒ ::Gapic::Operation
Updates inventory information for a Product while respecting the last update timestamps of each inventory field.
This process is asynchronous and does not require the Product to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by ProductService.GetProduct or ProductService.ListProducts.
When inventory is updated with ProductService.CreateProduct and ProductService.UpdateProduct, the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the ProductService.CreateProduct or ProductService.UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product is used.
If no inventory fields are set in SetInventoryRequest.set_mask, then any existing inventory information is preserved.
Pre-existing inventory information can only be updated with ProductService.SetInventory, ProductService.AddFulfillmentPlaces, and ProductService.RemoveFulfillmentPlaces.
The returned Operations is obsolete after
one day, and the GetOperation
API returns NOT_FOUND
afterwards.
If conflicting updates are issued, the Operations associated with the stale updates are not marked as done until they are obsolete.
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 1212 def set_inventory request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.set_inventory..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.set_inventory.timeout, metadata: , retry_policy: @config.rpcs.set_inventory.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.set_inventory request, do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: yield result, operation if block_given? throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |
#universe_domain ⇒ String
The effective universe domain
118 119 120 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 118 def universe_domain @product_service_stub.universe_domain end |
#update_product(request, options = nil) ⇒ ::Google::Cloud::Retail::V2::Product #update_product(product: nil, update_mask: nil, allow_missing: nil) ⇒ ::Google::Cloud::Retail::V2::Product
Updates a Product.
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 |
# File 'lib/google/cloud/retail/v2/product_service/rest/client.rb', line 628 def update_product request, = nil raise ::ArgumentError, "request must be provided" if request.nil? request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest # Converts hash and nil to an options object = ::Gapic::CallOptions.new(**.to_h) if .respond_to? :to_h # Customize the options with defaults = @config.rpcs.update_product..to_h # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ lib_name: @config.lib_name, lib_version: @config.lib_version, gapic_version: ::Google::Cloud::Retail::V2::VERSION, transports_version_send: [:rest] [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? [:"x-goog-user-project"] = @quota_project_id if @quota_project_id .apply_defaults timeout: @config.rpcs.update_product.timeout, metadata: , retry_policy: @config.rpcs.update_product.retry_policy .apply_defaults timeout: @config.timeout, metadata: @config., retry_policy: @config.retry_policy @product_service_stub.update_product request, do |result, operation| yield result, operation if block_given? end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end |