Module: Google::Cloud::Retail::V2::ProductService::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/retail/v2/product_service/paths.rb

Overview

Path helper methods for the ProductService API.

Instance Method Summary collapse

Instance Method Details

#branch_path(project:, location:, catalog:, branch:) ⇒ ::String

Create a fully-qualified Branch resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}

Parameters:

  • project (String)
  • location (String)
  • catalog (String)
  • branch (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


40
41
42
43
44
45
46
# File 'lib/google/cloud/retail/v2/product_service/paths.rb', line 40

def branch_path project:, location:, catalog:, branch:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"

  "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}"
end

#product_path(project:, location:, catalog:, branch:, product:) ⇒ ::String

Create a fully-qualified Product resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}

Parameters:

  • project (String)
  • location (String)
  • catalog (String)
  • branch (String)
  • product (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


62
63
64
65
66
67
68
69
# File 'lib/google/cloud/retail/v2/product_service/paths.rb', line 62

def product_path project:, location:, catalog:, branch:, product:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/"
  raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/"

  "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}"
end