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
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 GetProduct or ListProducts.
This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.
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 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.
- (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. No partial updating is supported. 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) — Unique identifier provided by client, within the ancestor
dataset scope. Ensures idempotency and used for request deduplication.
Server-generated if unspecified. Up to 128 characters long and must match
the pattern:
[a-zA-Z0-9_]+
. This is returned as [Operation.name][] in ImportMetadata.Only supported when ImportProductsRequest.reconciliation_mode is set to
FULL
. - 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, will by default update all fields.
- 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) — Pub/Sub topic for receiving notification. If this field is set,
when the import is finished, a notification will be sent to
specified Pub/Sub topic. The message data will be JSON string of a
Operation.
Format of the Pub/Sub topic is
projects/{project}/topics/{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 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.
- (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 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 GetProduct or ListProducts.
This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.
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 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 will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the Product queried by GetProduct or ListProducts.
When inventory is updated with CreateProduct and UpdateProduct, the specified inventory field value(s) will overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update time for the specified inventory fields will be overwritten to the time of the CreateProduct or UpdateProduct request.
If no inventory fields are set in CreateProductRequest.product, then any pre-existing inventory information for this product will be used.
If no inventory fields are set in [UpdateProductRequest.set_mask][], then any existing inventory information will be preserved.
Pre-existing inventory information can only be updated with SetInventory, AddFulfillmentPlaces, and RemoveFulfillmentPlaces.
This feature is only available for users who have Retail Search enabled. Please submit a form here to contact cloud sales if you are interested in using Retail Search.
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 last update time is recorded for the following inventory fields:
If a full overwrite of inventory information while ignoring timestamps is needed, [UpdateProduct][] should be invoked instead.
-
set_mask (::Google::Protobuf::FieldMask, ::Hash) — Indicates which inventory fields in the provided
Product to update. If 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.
- 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 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.
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.
-
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