Module: Google::Cloud::Dialogflow::V2::Environments::Paths

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

Overview

Path helper methods for the Environments API.

Instance Method Summary collapse

Instance Method Details

#agent_path(project: ) ⇒ ::String #agent_path(project: , location: ) ⇒ ::String

Create a fully-qualified Agent resource string.

Overloads:

  • #agent_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent

    Parameters:

    • project (String) (defaults to: )
  • #agent_path(project: , location: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/google/cloud/dialogflow/v2/environments/paths.rb', line 46

def agent_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}/agent"
    end),
    "location:project" => (proc do |project:, location:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agent"
    end)
  }

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

#environment_path(project: , environment: ) ⇒ ::String #environment_path(project: , location: , environment: ) ⇒ ::String

Create a fully-qualified Environment resource string.

Overloads:

  • #environment_path(project: , environment: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/environments/{environment}

    Parameters:

    • project (String) (defaults to: )
    • environment (String) (defaults to: )
  • #environment_path(project: , location: , environment: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/environments/{environment}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • environment (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/google/cloud/dialogflow/v2/environments/paths.rb', line 84

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

      "projects/#{project}/agent/environments/#{environment}"
    end),
    "environment:location:project" => (proc do |project:, location:, environment:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agent/environments/#{environment}"
    end)
  }

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

#fulfillment_path(project: ) ⇒ ::String #fulfillment_path(project: , location: ) ⇒ ::String

Create a fully-qualified Fulfillment resource string.

Overloads:

  • #fulfillment_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/fulfillment

    Parameters:

    • project (String) (defaults to: )
  • #fulfillment_path(project: , location: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/fulfillment

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/google/cloud/dialogflow/v2/environments/paths.rb', line 123

def fulfillment_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}/agent/fulfillment"
    end),
    "location:project" => (proc do |project:, location:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agent/fulfillment"
    end)
  }

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

#version_path(project: , version: ) ⇒ ::String #version_path(project: , location: , version: ) ⇒ ::String

Create a fully-qualified Version resource string.

Overloads:

  • #version_path(project: , version: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/versions/{version}

    Parameters:

    • project (String) (defaults to: )
    • version (String) (defaults to: )
  • #version_path(project: , location: , version: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/versions/{version}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • version (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/google/cloud/dialogflow/v2/environments/paths.rb', line 161

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

      "projects/#{project}/agent/versions/#{version}"
    end),
    "location:project:version" => (proc do |project:, location:, version:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agent/versions/#{version}"
    end)
  }

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