Class: Google::Apis::MerchantapiInventoriesV1beta::MerchantService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/merchantapi_inventories_v1beta/service.rb

Overview

Merchant API

Programmatically manage your Merchant Center Accounts.

Examples:

require 'google/apis/merchantapi_inventories_v1beta'

Merchantapi = Google::Apis::MerchantapiInventoriesV1beta # Alias the module
service = Merchantapi::MerchantService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://merchantapi.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMerchantService

Returns a new instance of MerchantService.



47
48
49
50
51
52
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 47

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-merchantapi_inventories_v1beta',
        client_version: Google::Apis::MerchantapiInventoriesV1beta::GEM_VERSION)
  @batch_path = 'batch'
end

Instance Attribute Details

#keyString

Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

Returns:

  • (String)

    API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.



40
41
42
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 40

def key
  @key
end

#quota_userString

Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

Returns:

  • (String)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.



45
46
47
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 45

def quota_user
  @quota_user
end

Instance Method Details

#delete_account_product_local_inventory(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::Empty

Deletes the specified LocalInventory from the given product in your merchant account. It might take a up to an hour for the LocalInventory to be deleted from the specific product. Once you have received a successful delete response, wait for that period before attempting a delete again.

Parameters:

  • name (String)

    Required. The name of the local inventory for the given product to delete. Format: accounts/account/products/product/localInventories/store_code Theproductsegment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: `content_language~feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~ offer_id`. Example: `local~en~US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. **Encoded Format**: Theproductsegment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in the ` content_language~feed_label~offer_id` structure. This encoding MUST be used if any part of the product identifier (like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123` for `store_code` "store123", theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name for the local inventory would be `accounts/123/products/ZW5-VVN- c2t1LzEyMw/localInventories/store123`. 2. **Plain Format**: Theproduct segment is the tilde-separated string `content_language~feed_label~offer_id`. This format is suitable only when `content_language`, `feed_label`, and ` offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



100
101
102
103
104
105
106
107
108
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 100

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'inventories/v1beta/{+name}', options)
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::Empty::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_account_product_regional_inventory(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::Empty

Deletes the specified RegionalInventory resource from the given product in your merchant account. It might take up to an hour for the RegionalInventory to be deleted from the specific product. Once you have received a successful delete response, wait for that period before attempting a delete again.

Parameters:

  • name (String)

    Required. The name of the RegionalInventory resource to delete. Format: accounts/account/products/product/regionalInventories/regionThe productsegment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: ` content_language~feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~offer_id`. Example: `local~en~US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. ** Encoded Format**: Theproductsegment is an **unpadded base64url** encoded string (RFC 4648 Section 5). The decoded string must result in the ` content_language~feed_label~offer_id` structure. This encoding MUST be used if any part of the product identifier (like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123` for `region` "region123", theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name for the regional inventory would be `accounts/123/products/ZW5- VVN-c2t1LzEyMw/regionalInventories/region123`. 2. **Plain Format**: The productsegment is the tilde-separated string `content_language~feed_label~ offer_id`. This format is suitable only when `content_language`, `feed_label`, and `offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



284
285
286
287
288
289
290
291
292
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 284

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'inventories/v1beta/{+name}', options)
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::Empty::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::Empty
  command.params['name'] = name unless name.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#insert_account_product_local_inventory(parent, local_inventory_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::LocalInventory

Inserts a LocalInventory resource to a product in your merchant account. Replaces the full LocalInventory resource if an entry with the same storeCode already exists for the product. It might take up to 30 minutes for the new or updated LocalInventory resource to appear in products.

Parameters:

  • parent (String)

    Required. The account and product where this inventory will be inserted. Format: accounts/account/products/productTheproductsegment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: `content_language~ feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~offer_id`. Example: `local~en~ US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. **Encoded Format**: The productsegment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in the `content_language~feed_label~offer_id` structure. This encoding MUST be used if any part of the product identifier ( like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123`, theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name for the product would be `accounts/123/products/ZW5-VVN- c2t1LzEyMw`. 2. **Plain Format**: Theproductsegment is the tilde- separated string `content_language~feed_label~offer_id`. This format is suitable only when `content_language`, `feed_label`, and `offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • local_inventory_object (Google::Apis::MerchantapiInventoriesV1beta::LocalInventory) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



156
157
158
159
160
161
162
163
164
165
166
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 156

def (parent, local_inventory_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'inventories/v1beta/{+parent}/localInventories:insert', options)
  command.request_representation = Google::Apis::MerchantapiInventoriesV1beta::LocalInventory::Representation
  command.request_object = local_inventory_object
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::LocalInventory::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::LocalInventory
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#insert_account_product_regional_inventory(parent, regional_inventory_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::RegionalInventory

Inserts a RegionalInventory to a given product in your merchant account. Replaces the full RegionalInventory resource if an entry with the same region already exists for the product. It might take up to 30 minutes for the new or updated RegionalInventory resource to appear in products.

Parameters:

  • parent (String)

    Required. The account and product where this inventory will be inserted. Format: accounts/account/products/productTheproductsegment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: `content_language~ feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~offer_id`. Example: `local~en~ US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. **Encoded Format**: The productsegment is an **unpadded base64url** encoded string (RFC 4648 Section 5). The decoded string must result in the `content_language~feed_label~ offer_id` structure. This encoding MUST be used if any part of the product identifier (like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123`, theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN- c2t1LzEyMw`. The full resource name for the product would be `accounts/123/ products/ZW5-VVN-c2t1LzEyMw`. 2. **Plain Format**: Theproductsegment is the tilde-separated string `content_language~feed_label~offer_id`. This format is suitable only when `content_language`, `feed_label`, and `offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • regional_inventory_object (Google::Apis::MerchantapiInventoriesV1beta::RegionalInventory) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



340
341
342
343
344
345
346
347
348
349
350
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 340

def (parent, regional_inventory_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'inventories/v1beta/{+parent}/regionalInventories:insert', options)
  command.request_representation = Google::Apis::MerchantapiInventoriesV1beta::RegionalInventory::Representation
  command.request_object = regional_inventory_object
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::RegionalInventory::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::RegionalInventory
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_account_product_local_inventories(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::ListLocalInventoriesResponse

Lists the LocalInventory resources for the given product in your merchant account. The response might contain fewer items than specified by pageSize. If pageToken was returned in previous request, it can be used to obtain additional results. LocalInventory resources are listed per product for a given account.

Parameters:

  • parent (String)

    Required. The name of the parent product to list local inventories for. Format: accounts/account/products/productTheproductsegment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: `content_language~ feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~offer_id`. Example: `local~en~ US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. **Encoded Format**: The productsegment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in the `content_language~feed_label~offer_id` structure. This encoding MUST be used if any part of the product identifier ( like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123`, theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name for the product would be `accounts/123/products/ZW5-VVN- c2t1LzEyMw`. 2. **Plain Format**: Theproductsegment is the tilde- separated string `content_language~feed_label~offer_id`. This format is suitable only when `content_language`, `feed_label`, and `offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • page_size (Fixnum) (defaults to: nil)

    The maximum number of LocalInventory resources for the given product to return. The service returns fewer than this value if the number of inventories for the given product is less that than the pageSize. The default value is

    1. The maximum value is 25000; If a value higher than the maximum is specified, then the pageSize will default to the maximum
  • page_token (String) (defaults to: nil)

    A page token, received from a previous ListLocalInventories call. Provide the page token to retrieve the subsequent page. When paginating, all other parameters provided to ListLocalInventories must match the call that provided the page token. The token returned as nextPageToken in the response to the previous request.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



226
227
228
229
230
231
232
233
234
235
236
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 226

def (parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'inventories/v1beta/{+parent}/localInventories', options)
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::ListLocalInventoriesResponse::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::ListLocalInventoriesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#list_account_product_regional_inventories(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::MerchantapiInventoriesV1beta::ListRegionalInventoriesResponse

Lists the RegionalInventory resources for the given product in your merchant account. The response might contain fewer items than specified by pageSize. If pageToken was returned in previous request, it can be used to obtain additional results. RegionalInventory resources are listed per product for a given account.

Parameters:

  • parent (String)

    Required. The name of the parent product to list RegionalInventory resources for. Format: accounts/account/products/productTheproduct segment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: ` content_language~feed_label~offer_id`. Example: `en~US~sku123` For legacy local products, the structure is: `local~content_language~feed_label~offer_id`. Example: `local~en~US~sku123` The format of theproductsegment in the URL is automatically detected by the server, supporting two options: 1. ** Encoded Format**: Theproductsegment is an **unpadded base64url** encoded string (RFC 4648 Section 5). The decoded string must result in the ` content_language~feed_label~offer_id` structure. This encoding MUST be used if any part of the product identifier (like `offer_id`) contains characters such as `/`, `%`, or `~`. * Example: To represent the product ID `en~US~sku/123`, theproductsegment must be the unpadded base64url encoding of this string, which is `ZW5-VVN-c2t1LzEyMw`. The full resource name for the product would be `accounts/123/products/ZW5-VVN-c2t1LzEyMw`. 2. **Plain Format**: The productsegment is the tilde-separated string `content_language~feed_label~ offer_id`. This format is suitable only when `content_language`, `feed_label`, and `offer_id` do not contain URL-problematic characters like `/`, `%`, or `~`. We recommend using the **Encoded Format** for all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (`~`) characters in theproduct`` segment is used to differentiate between the two formats.

  • page_size (Fixnum) (defaults to: nil)

    The maximum number of RegionalInventory resources for the given product to return. The service returns fewer than this value if the number of inventories for the given product is less that than the pageSize. The default value is

    1. The maximum value is 100000; If a value higher than the maximum is specified, then the pageSize will default to the maximum.
  • page_token (String) (defaults to: nil)

    A page token, received from a previous ListRegionalInventories call. Provide the page token to retrieve the subsequent page. When paginating, all other parameters provided to ListRegionalInventories must match the call that provided the page token. The token returned as nextPageToken in the response to the previous request.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



410
411
412
413
414
415
416
417
418
419
420
# File 'lib/google/apis/merchantapi_inventories_v1beta/service.rb', line 410

def (parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'inventories/v1beta/{+parent}/regionalInventories', options)
  command.response_representation = Google::Apis::MerchantapiInventoriesV1beta::ListRegionalInventoriesResponse::Representation
  command.response_class = Google::Apis::MerchantapiInventoriesV1beta::ListRegionalInventoriesResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end