Module: Google::Cloud::Firestore::Admin::V1::FirestoreAdmin::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb

Overview

Path helper methods for the FirestoreAdmin API.

Instance Method Summary collapse

Instance Method Details

#collection_group_path(project:, database:, collection:) ⇒ ::String

Create a fully-qualified CollectionGroup resource string.

The resource will be in the following format:

projects/{project}/databases/{database}/collectionGroups/{collection}

Parameters:

  • project (String)
  • database (String)
  • collection (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


40
41
42
43
44
45
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb', line 40

def collection_group_path project:, database:, collection:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "database cannot contain /" if database.to_s.include? "/"

  "projects/#{project}/databases/#{database}/collectionGroups/#{collection}"
end

#database_path(project:, database:) ⇒ ::String

Create a fully-qualified Database resource string.

The resource will be in the following format:

projects/{project}/databases/{database}

Parameters:

  • project (String)
  • database (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


58
59
60
61
62
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb', line 58

def database_path project:, database:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/databases/#{database}"
end

#field_path(project:, database:, collection:, field:) ⇒ ::String

Create a fully-qualified Field resource string.

The resource will be in the following format:

projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}

Parameters:

  • project (String)
  • database (String)
  • collection (String)
  • field (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


77
78
79
80
81
82
83
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb', line 77

def field_path project:, database:, collection:, field:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "database cannot contain /" if database.to_s.include? "/"
  raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"

  "projects/#{project}/databases/#{database}/collectionGroups/#{collection}/fields/#{field}"
end

#index_path(project:, database:, collection:, index:) ⇒ ::String

Create a fully-qualified Index resource string.

The resource will be in the following format:

projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}

Parameters:

  • project (String)
  • database (String)
  • collection (String)
  • index (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


98
99
100
101
102
103
104
# File 'lib/google/cloud/firestore/admin/v1/firestore_admin/paths.rb', line 98

def index_path project:, database:, collection:, index:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "database cannot contain /" if database.to_s.include? "/"
  raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"

  "projects/#{project}/databases/#{database}/collectionGroups/#{collection}/indexes/#{index}"
end