Module: Google::Cloud::Dialogflow::V2::AnswerRecords::Paths

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

Overview

Path helper methods for the AnswerRecords API.

Instance Method Summary collapse

Instance Method Details

#answer_record_path(project:, answer_record:) ⇒ ::String #answer_record_path(project:, location:, answer_record:) ⇒ ::String

Create a fully-qualified AnswerRecord resource string.

Overloads:

  • #answer_record_path(project:, answer_record:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/answerRecords/{answer_record}

    Parameters:

    • project (String)
    • answer_record (String)
  • #answer_record_path(project:, location:, answer_record:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/answerRecords/{answer_record}

    Parameters:

    • project (String)
    • location (String)
    • answer_record (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 48

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

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

      "projects/#{project}/locations/#{location}/answerRecords/#{answer_record}"
    end)
  }

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

#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)


80
81
82
83
84
85
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 80

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

#context_path(project:, session:, context:) ⇒ ::String #context_path(project:, environment:, user:, session:, context:) ⇒ ::String #context_path(project:, location:, session:, context:) ⇒ ::String #context_path(project:, location:, environment:, user:, session:, context:) ⇒ ::String

Create a fully-qualified Context resource string.

Overloads:

  • #context_path(project:, session:, context:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/sessions/{session}/contexts/{context}

    Parameters:

    • project (String)
    • session (String)
    • context (String)
  • #context_path(project:, environment:, user:, session:, context:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}

    Parameters:

    • project (String)
    • environment (String)
    • user (String)
    • session (String)
    • context (String)
  • #context_path(project:, location:, session:, context:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}

    Parameters:

    • project (String)
    • location (String)
    • session (String)
    • context (String)
  • #context_path(project:, location:, environment:, user:, session:, context:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}

    Parameters:

    • project (String)
    • location (String)
    • environment (String)
    • user (String)
    • session (String)
    • context (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 133

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

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

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

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

      "projects/#{project}/locations/#{location}/agent/environments/#{environment}/users/#{user}/sessions/#{session}/contexts/#{context}"
    end)
  }

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

#intent_path(project:, intent:) ⇒ ::String #intent_path(project:, location:, intent:) ⇒ ::String

Create a fully-qualified Intent resource string.

Overloads:

  • #intent_path(project:, intent:) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/intents/{intent}

    Parameters:

    • project (String)
    • intent (String)
  • #intent_path(project:, location:, intent:) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

    • project (String)
    • location (String)
    • intent (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 193

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

      "projects/#{project}/agent/intents/#{intent}"
    end),
    "intent:location:project" => (proc do |project:, location:, intent:|
      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/intents/#{intent}"
    end)
  }

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

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

Create a fully-qualified Location resource string.

The resource will be in the following format:

projects/{project}/locations/{location}

Parameters:

  • project (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


224
225
226
227
228
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 224

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

  "projects/#{project}/locations/#{location}"
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)


240
241
242
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 240

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)


267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 267

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)


302
303
304
305
306
307
308
# File 'lib/google/cloud/dialogflow/v2/answer_records/paths.rb', line 302

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