Module: Google::Cloud::Dialogflow::V2::Generators::Paths

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

Overview

Path helper methods for the Generators API.

Instance Method Summary collapse

Instance Method Details

#app_path(project:, location:, app:) ⇒ ::String

Create a fully-qualified App resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apps/{app}

Parameters:

  • project (String)
  • location (String)
  • app (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


39
40
41
42
43
44
# File 'lib/google/cloud/dialogflow/v2/generators/paths.rb', line 39

def app_path project:, location:, app:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/apps/#{app}"
end

#generator_path(project:, location:, generator:) ⇒ ::String

Create a fully-qualified Generator resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/generators/{generator}

Parameters:

  • project (String)
  • location (String)
  • generator (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


58
59
60
61
62
63
# File 'lib/google/cloud/dialogflow/v2/generators/paths.rb', line 58

def generator_path project:, location:, generator:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/generators/#{generator}"
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


75
76
77
# File 'lib/google/cloud/dialogflow/v2/generators/paths.rb', line 75

def project_path project:
  "projects/#{project}"
end

#tool_path(project:, location:, tool:) ⇒ ::String #tool_path(project:, location:, app:, tool:) ⇒ ::String

Create a fully-qualified Tool resource string.

Overloads:

  • #tool_path(project:, location:, tool:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/tools/{tool}

    Parameters:

    • project (String)
    • location (String)
    • tool (String)
  • #tool_path(project:, location:, app:, tool:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/apps/{app}/tools/{tool}

    Parameters:

    • project (String)
    • location (String)
    • app (String)
    • tool (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/google/cloud/dialogflow/v2/generators/paths.rb', line 102

def tool_path **args
  resources = {
    "location:project:tool" => (proc do |project:, location:, tool:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/tools/#{tool}"
    end),
    "app:location:project:tool" => (proc do |project:, location:, app:, tool:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
      raise ::ArgumentError, "app cannot contain /" if app.to_s.include? "/"

      "projects/#{project}/locations/#{location}/apps/#{app}/tools/#{tool}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#toolset_path(project:, location:, app:, toolset:) ⇒ ::String

Create a fully-qualified Toolset resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}

Parameters:

  • project (String)
  • location (String)
  • app (String)
  • toolset (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


137
138
139
140
141
142
143
# File 'lib/google/cloud/dialogflow/v2/generators/paths.rb', line 137

def toolset_path project:, location:, app:, toolset:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "app cannot contain /" if app.to_s.include? "/"

  "projects/#{project}/locations/#{location}/apps/#{app}/toolsets/#{toolset}"
end