Reference documentation and code samples for the Retail V2 API class Google::Cloud::Retail::V2::ProductService::Client.
Client for the ProductService service.
Service for ingesting Product information of the customer's website.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the ProductService Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all ProductService clients ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config| config.timeout = 10.0 end
#add_fulfillment_places
def add_fulfillment_places(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Longrunning::Operation Operation}s associated with the stale updates will not be marked as done until being obsolete.
def add_fulfillment_places(request, options = nil) -> ::Gapic::Operation
add_fulfillment_places
via a request object, either of type
AddFulfillmentPlacesRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) -> ::Gapic::Operation
add_fulfillment_places
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
product (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
-
type (::String) — Required. The fulfillment type, including commonly used types (such as
pickup in store and same day delivery), and custom types.
Supported values:
- "pickup-in-store"
- "ship-to-store"
- "same-day-delivery"
- "next-day-delivery"
- "custom-type-1"
- "custom-type-2"
- "custom-type-3"
- "custom-type-4"
- "custom-type-5"
If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.
This field directly corresponds to Product.fulfillment_info.type.
-
place_ids (::Array<::String>) — Required. The IDs for this
type, such as
the store IDs for "pickup-in-store" or the region IDs for
"same-day-delivery" to be added for this
type. Duplicate
IDs will be automatically ignored.
At least 1 value is required, and a maximum of 2000 values are allowed. Each value must be a string with a length limit of 10 characters, matching the pattern
[a-zA-Z0-9_-]+
, such as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned.If the total number of place IDs exceeds 2000 for this type after adding, then the update will be rejected.
- add_time (::Google::Protobuf::Timestamp, ::Hash) — The time when the fulfillment updates are issued, used to prevent out-of-order updates on fulfillment information. If not provided, the internal system time will be used.
- allow_missing (::Boolean) — If set to true, and the Product is not found, the fulfillment information will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new # Call the add_fulfillment_places method. result = client.add_fulfillment_places request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#add_local_inventories
def add_local_inventories(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Longrunning::Operation Operation}s associated with the stale updates will not be marked as done until being obsolete.
def add_local_inventories(request, options = nil) -> ::Gapic::Operation
add_local_inventories
via a request object, either of type
AddLocalInventoriesRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) -> ::Gapic::Operation
add_local_inventories
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
product (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
- local_inventories (::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>) — Required. A list of inventory information at difference places. Each place is identified by its place ID. At most 3000 inventories are allowed per request.
-
add_mask (::Google::Protobuf::FieldMask, ::Hash) — Indicates which inventory fields in the provided list of
LocalInventory to update. The
field is updated to the provided value.
If a field is set while the place does not have a previous local inventory, the local inventory at that store is created.
If a field is set while the value of that field is not provided, the original field value, if it exists, is deleted.
If the mask is not set or set with empty paths, all inventory fields will be updated.
If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned and the entire update will be ignored.
- add_time (::Google::Protobuf::Timestamp, ::Hash) — The time when the inventory updates are issued. Used to prevent out-of-order updates on local inventory fields. If not provided, the internal system time will be used.
- allow_missing (::Boolean) — If set to true, and the Product is not found, the local inventory will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new # Call the add_local_inventories method. result = client.add_local_inventories request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#configure
def 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 Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_product
def create_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
def create_product(parent: nil, product: nil, product_id: nil) -> ::Google::Cloud::Retail::V2::Product
Creates a Product.
def create_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
create_product
via a request object, either of type
CreateProductRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_product(parent: nil, product: nil, product_id: nil) -> ::Google::Cloud::Retail::V2::Product
create_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent catalog resource name, such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch
. - product (::Google::Cloud::Retail::V2::Product, ::Hash) — Required. The Product to create.
-
product_id (::String) — Required. The ID to use for the Product,
which will become the final component of the
Product.name.
If the caller does not have permission to create the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
This field must be unique among all Products with the same parent. Otherwise, an ALREADY_EXISTS error is returned.
This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Retail::V2::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::CreateProductRequest.new # Call the create_product method. result = client.create_product request # The returned object is of type Google::Cloud::Retail::V2::Product. p result
#delete_product
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
def delete_product(name: nil) -> ::Google::Protobuf::Empty
Deletes a Product.
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
delete_product
via a request object, either of type
DeleteProductRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_product(name: nil) -> ::Google::Protobuf::Empty
delete_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to delete the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the Product to delete does not exist, a NOT_FOUND error is returned.
The Product to delete can neither be a Product.Type.COLLECTION Product member nor a Product.Type.PRIMARY Product with more than one variants. Otherwise, an INVALID_ARGUMENT error is returned.
All inventory information for the named Product will be deleted.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::DeleteProductRequest.new # Call the delete_product method. result = client.delete_product request # The returned object is of type Google::Protobuf::Empty. p result
#get_product
def get_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
def get_product(name: nil) -> ::Google::Cloud::Retail::V2::Product
Gets a Product.
def get_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
get_product
via a request object, either of type
GetProductRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::GetProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_product(name: nil) -> ::Google::Cloud::Retail::V2::Product
get_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the requested Product does not exist, a NOT_FOUND error is returned.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Retail::V2::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::GetProductRequest.new # Call the get_product method. result = client.get_product request # The returned object is of type Google::Cloud::Retail::V2::Product. p result
#import_products
def import_products(request, options = nil) -> ::Gapic::Operation
def 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
Bulk import of multiple Products.
Request processing may be synchronous. Non-existing items are created.
Note that it is possible for a subset of the {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated.
def import_products(request, options = nil) -> ::Gapic::Operation
import_products
via a request object, either of type
ImportProductsRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def 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
import_products
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required.
projects/1234/locations/global/catalogs/default_catalog/branches/default_branch
If no updateMask is specified, requires products.create permission. If updateMask is specified, requires products.update permission.
- request_id (::String) — Deprecated. This field has no effect.
- input_config (::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash) — Required. The desired input location of the data.
- errors_config (::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash) — The desired location of errors incurred during the Import.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Indicates which fields in the provided imported
products
to update. If not set, all fields are updated. If provided, only the existing product fields are updated. Missing products will not be created. - reconciliation_mode (::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode) — The mode of reconciliation between existing products and the products to be imported. Defaults to ReconciliationMode.INCREMENTAL.
-
notification_pubsub_topic (::String) — Full Pub/Sub topic name for receiving notification. If this field is set,
when the import is finished, a notification is sent to
specified Pub/Sub topic. The message data is JSON string of a
Operation.
Format of the Pub/Sub topic is
projects/{project}/topics/{topic}
. It has to be within the same project as ImportProductsRequest.parent. Make sure that bothcloud-retail-customer-data-access@system.gserviceaccount.com
andservice-<project number>@gcp-sa-retail.iam.gserviceaccount.com
have thepubsub.topics.publish
IAM permission on the topic.Only supported when ImportProductsRequest.reconciliation_mode is set to
FULL
.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::ImportProductsRequest.new # Call the import_products method. result = client.import_products request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#initialize
def initialize() { |config| ... } -> Client
Create a new ProductService client object.
- (config) — Configure the ProductService client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Retail::V2::ProductService::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| config.timeout = 10.0 end
#list_products
def list_products(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
def list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
Gets a list of {::Google::Cloud::Retail::V2::Product Product}s.
def list_products(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
list_products
via a request object, either of type
ListProductsRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
list_products
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The parent branch resource name, such as
projects/*/locations/global/catalogs/default_catalog/branches/0
. Usedefault_branch
as the branch ID, to list products under the default branch.If the caller does not have permission to list {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of whether or not this branch exists, a PERMISSION_DENIED error is returned.
-
page_size (::Integer) — Maximum number of Products to return. If
unspecified, defaults to 100. The maximum allowed value is 1000. Values
above 1000 will be coerced to 1000.
If this field is negative, an INVALID_ARGUMENT error is returned.
-
page_token (::String) — A page token
ListProductsResponse.next_page_token,
received from a previous
ProductService.ListProducts
call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to ProductService.ListProducts must match the call that provided the page token. Otherwise, an INVALID_ARGUMENT error is returned.
-
filter (::String) — A filter to apply on the list results. Supported features:
- List all the products under the parent branch if filter is unset.
- List Product.Type.VARIANT
Products sharing the same
Product.Type.PRIMARY
Product. For example:
primary_product_id = "some_product_id"
- List Products bundled in a
Product.Type.COLLECTION
Product.
For example:
collection_product_id = "some_product_id"
- List Products with a partibular type.
For example:
type = "PRIMARY"
type = "VARIANT"
type = "COLLECTION"
If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
If the specified Product.Type.PRIMARY Product or Product.Type.COLLECTION Product does not exist, a NOT_FOUND error is returned.
-
read_mask (::Google::Protobuf::FieldMask, ::Hash) — The fields of Product to return in the
responses. If not set or empty, the following fields are returned:
If "*" is provided, all fields are returned. Product.name is always returned no matter what mask is set.
If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::ListProductsRequest.new # Call the list_products method. result = client.list_products request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Retail::V2::Product. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#operations_client
def operations_client() -> ::Google::Cloud::Retail::V2::ProductService::Operations
Get the associated client for long-running operations.
#purge_products
def purge_products(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Cloud::Retail::V2::Product Product}s, this operation could take hours to complete. To get a sample of {::Google::Cloud::Retail::V2::Product Product}s that would be deleted, set PurgeProductsRequest.force to false.
def purge_products(request, options = nil) -> ::Gapic::Operation
purge_products
via a request object, either of type
Google::Cloud::Retail::V2::PurgeProductsRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def purge_products(parent: nil, filter: nil, force: nil) -> ::Gapic::Operation
purge_products
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The resource name of the branch under which the products are
created. The format is
projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}
-
filter (::String) —
Required. The filter string to specify the products to be deleted with a length limit of 5,000 characters.
Empty string filter is not allowed. "*" implies delete all items in a branch.
The eligible fields for filtering are:
availability
: Double quoted Product.availability string.create_time
: in ISO 8601 "zulu" format.
Supported syntax:
Comparators (">", "<", ">=", "<=", "="). Examples:
- create_time <= "2015-02-13T17:05:46Z"
- availability = "IN_STOCK"
Conjunctions ("AND") Examples:
- create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
Disjunctions ("OR") Examples:
- create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
Can support nested queries. Examples:
- (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
Filter Limits:
- Filter should not contain more than 6 conditions.
- Max nesting depth should not exceed 2 levels.
Examples queries:
- Delete back order products created before a timestamp. create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
-
force (::Boolean) — Actually perform the purge.
If
force
is set to false, the method will return the expected purge count without deleting any products.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::PurgeProductsRequest.new # Call the purge_products method. result = client.purge_products request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#remove_fulfillment_places
def remove_fulfillment_places(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Longrunning::Operation Operation}s associated with the stale updates will not be marked as done until being obsolete.
def remove_fulfillment_places(request, options = nil) -> ::Gapic::Operation
remove_fulfillment_places
via a request object, either of type
RemoveFulfillmentPlacesRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) -> ::Gapic::Operation
remove_fulfillment_places
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
product (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
-
type (::String) — Required. The fulfillment type, including commonly used types (such as
pickup in store and same day delivery), and custom types.
Supported values:
- "pickup-in-store"
- "ship-to-store"
- "same-day-delivery"
- "next-day-delivery"
- "custom-type-1"
- "custom-type-2"
- "custom-type-3"
- "custom-type-4"
- "custom-type-5"
If this field is set to an invalid value other than these, an INVALID_ARGUMENT error is returned.
This field directly corresponds to Product.fulfillment_info.type.
-
place_ids (::Array<::String>) — Required. The IDs for this
type, such as
the store IDs for "pickup-in-store" or the region IDs for
"same-day-delivery", to be removed for this
type.
At least 1 value is required, and a maximum of 2000 values are allowed. Each value must be a string with a length limit of 10 characters, matching the pattern
[a-zA-Z0-9_-]+
, such as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is returned. - remove_time (::Google::Protobuf::Timestamp, ::Hash) — The time when the fulfillment updates are issued, used to prevent out-of-order updates on fulfillment information. If not provided, the internal system time will be used.
- allow_missing (::Boolean) — If set to true, and the Product is not found, the fulfillment information will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new # Call the remove_fulfillment_places method. result = client.remove_fulfillment_places request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#remove_local_inventories
def remove_local_inventories(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Longrunning::Operation Operation}s associated with the stale updates will not be marked as done until being obsolete.
def remove_local_inventories(request, options = nil) -> ::Gapic::Operation
remove_local_inventories
via a request object, either of type
RemoveLocalInventoriesRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) -> ::Gapic::Operation
remove_local_inventories
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
product (::String) — Required. Full resource name of Product,
such as
projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id
.If the caller does not have permission to access the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
- place_ids (::Array<::String>) — Required. A list of place IDs to have their inventory deleted. At most 3000 place IDs are allowed per request.
- remove_time (::Google::Protobuf::Timestamp, ::Hash) — The time when the inventory deletions are issued. Used to prevent out-of-order updates and deletions on local inventory fields. If not provided, the internal system time will be used.
- allow_missing (::Boolean) — If set to true, and the Product is not found, the local inventory removal request will still be processed and retained for at most 1 day and processed once the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new # Call the remove_local_inventories method. result = client.remove_local_inventories request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#set_inventory
def set_inventory(request, options = nil) -> ::Gapic::Operation
def 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 {::Google::Longrunning::Operation Operation}s associated with the stale updates are not marked as done until they are obsolete.
def set_inventory(request, options = nil) -> ::Gapic::Operation
set_inventory
via a request object, either of type
SetInventoryRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) -> ::Gapic::Operation
set_inventory
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
inventory (::Google::Cloud::Retail::V2::Product, ::Hash) — Required. The inventory information to update. The allowable fields to
update are:
- Product.price_info
- Product.availability
- Product.available_quantity
- Product.fulfillment_info The updated inventory fields must be specified in SetInventoryRequest.set_mask.
If SetInventoryRequest.inventory.name is empty or invalid, an INVALID_ARGUMENT error is returned.
If the caller does not have permission to update the Product named in Product.name, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the Product to update does not have existing inventory information, the provided inventory information will be inserted.
If the Product to update has existing inventory information, the provided inventory information will be merged while respecting the last update time for each inventory field, using the provided or default value for SetInventoryRequest.set_time.
The caller can replace place IDs for a subset of fulfillment types in the following ways:
- Adds "fulfillment_info" in SetInventoryRequest.set_mask
- Specifies only the desired fulfillment types and corresponding place IDs to update in SetInventoryRequest.inventory.fulfillment_info
The caller can clear all place IDs from a subset of fulfillment types in the following ways:
- Adds "fulfillment_info" in SetInventoryRequest.set_mask
- Specifies only the desired fulfillment types to clear in SetInventoryRequest.inventory.fulfillment_info
- Checks that only the desired fulfillment info types have empty SetInventoryRequest.inventory.fulfillment_info.place_ids
The last update time is recorded for the following inventory fields:
If a full overwrite of inventory information while ignoring timestamps is needed, ProductService.UpdateProduct should be invoked instead.
-
set_mask (::Google::Protobuf::FieldMask, ::Hash) — Indicates which inventory fields in the provided
Product to update.
At least one field must be provided.
If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned and the entire update will be ignored.
- set_time (::Google::Protobuf::Timestamp, ::Hash) — The time when the request is issued, used to prevent out-of-order updates on inventory fields with the last update time recorded. If not provided, the internal system time will be used.
- allow_missing (::Boolean) — If set to true, and the Product with name Product.name is not found, the inventory update will still be processed and retained for at most 1 day until the Product is created. If set to false, a NOT_FOUND error is returned if the Product is not found.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::SetInventoryRequest.new # Call the set_inventory method. result = client.set_inventory request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)
#update_product
def update_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
def update_product(product: nil, update_mask: nil, allow_missing: nil) -> ::Google::Cloud::Retail::V2::Product
Updates a Product.
def update_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
update_product
via a request object, either of type
UpdateProductRequest or an equivalent Hash.
- request (::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_product(product: nil, update_mask: nil, allow_missing: nil) -> ::Google::Cloud::Retail::V2::Product
update_product
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
product (::Google::Cloud::Retail::V2::Product, ::Hash) — Required. The product to update/create.
If the caller does not have permission to update the Product, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.
If the Product to update does not exist and allow_missing is not set, a NOT_FOUND error is returned.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Indicates which fields in the provided
Product to update. The immutable and
output only fields are NOT supported. If not set, all supported fields (the
fields that are neither immutable nor output only) are updated.
If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.
The attribute key can be updated by setting the mask path as "attributes.${key_name}". If a key name is present in the mask but not in the patching product from the request, this key will be deleted after the update.
-
allow_missing (::Boolean) — If set to true, and the Product is not
found, a new Product will be created. In
this situation,
update_mask
is ignored.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Retail::V2::Product)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/retail/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Retail::V2::ProductService::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Retail::V2::UpdateProductRequest.new # Call the update_product method. result = client.update_product request # The returned object is of type Google::Cloud::Retail::V2::Product. p result