Retail V2 API - Class Google::Cloud::Retail::V2::ProductService::Client (v0.12.0)

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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# 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

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.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Overloads
def add_fulfillment_places(request, options = nil) -> ::Gapic::Operation
Pass arguments to add_fulfillment_places via a request object, either of type AddFulfillmentPlacesRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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 Operations associated with the stale updates will not be marked as done until being obsolete.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Overloads
def add_local_inventories(request, options = nil) -> ::Gapic::Operation
Pass arguments to add_local_inventories via a request object, either of type AddLocalInventoriesRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#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.

Overloads
def create_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
Pass arguments to create_product via a request object, either of type CreateProductRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

Overloads
def delete_product(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_product via a request object, either of type DeleteProductRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • 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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

Overloads
def get_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
Pass arguments to get_product via a request object, either of type GetProductRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • 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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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.

Overloads
def import_products(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_products via a request object, either of type ImportProductsRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
  • 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 service-<project number>@gcp-sa-retail.iam.gserviceaccount.com has the pubsub.topics.publish IAM permission on the topic.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#initialize

def initialize() { |config| ... } -> Client

Create a new ProductService client object.

Yields
  • (config) — Configure the ProductService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# 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.

Overloads
def list_products(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>
Pass arguments to list_products via a request object, either of type ListProductsRequest or an equivalent Hash.
Parameters
  • 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>
Pass arguments to 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).
Parameters
  • parent (::String) — Required. The parent branch resource name, such as projects/*/locations/global/catalogs/default_catalog/branches/0. Use default_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:

    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.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Retail::V2::Product.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::Retail::V2::ProductService::Operations

Get the associated client for long-running operations.

#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

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.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Overloads
def remove_fulfillment_places(request, options = nil) -> ::Gapic::Operation
Pass arguments to remove_fulfillment_places via a request object, either of type RemoveFulfillmentPlacesRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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 Operations associated with the stale updates will not be marked as done until being obsolete.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Overloads
def remove_local_inventories(request, options = nil) -> ::Gapic::Operation
Pass arguments to remove_local_inventories via a request object, either of type RemoveLocalInventoriesRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
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 Operations associated with the stale updates are not marked as done until they are obsolete.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Overloads
def set_inventory(request, options = nil) -> ::Gapic::Operation
Pass arguments to set_inventory via a request object, either of type SetInventoryRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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 this
# object to check the status of an operation, cancel it, or wait
# for results. Here is how to block until completion:
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "Error!"
end

#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.

Overloads
def update_product(request, options = nil) -> ::Google::Cloud::Retail::V2::Product
Pass arguments to update_product via a request object, either of type UpdateProductRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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