Module: Google::Cloud::Dialogflow::V2::Sessions::Paths

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

Overview

Path helper methods for the Sessions API.

Instance Method Summary collapse

Instance Method Details

#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) (defaults to: )
    • session (String) (defaults to: )
    • context (String) (defaults to: )
  • #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) (defaults to: )
    • environment (String) (defaults to: )
    • user (String) (defaults to: )
    • session (String) (defaults to: )
    • context (String) (defaults to: )
  • #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) (defaults to: )
    • location (String) (defaults to: )
    • session (String) (defaults to: )
    • context (String) (defaults to: )
  • #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) (defaults to: )
    • location (String) (defaults to: )
    • environment (String) (defaults to: )
    • user (String) (defaults to: )
    • session (String) (defaults to: )
    • context (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 73

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

#phrase_set_path(project:, location:, phrase_set:) ⇒ ::String

Create a fully-qualified PhraseSet resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/phraseSets/{phrase_set}

Parameters:

  • project (String)
  • location (String)
  • phrase_set (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


124
125
126
127
128
129
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 124

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

  "projects/#{project}/locations/#{location}/phraseSets/#{phrase_set}"
end

#session_entity_type_path(project: , session: , entity_type: ) ⇒ ::String #session_entity_type_path(project: , environment: , user: , session: , entity_type: ) ⇒ ::String #session_entity_type_path(project: , location: , session: , entity_type: ) ⇒ ::String #session_entity_type_path(project: , location: , environment: , user: , session: , entity_type: ) ⇒ ::String

Create a fully-qualified SessionEntityType resource string.

Overloads:

  • #session_entity_type_path(project: , session: , entity_type: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}

    Parameters:

    • project (String) (defaults to: )
    • session (String) (defaults to: )
    • entity_type (String) (defaults to: )
  • #session_entity_type_path(project: , environment: , user: , session: , entity_type: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}

    Parameters:

    • project (String) (defaults to: )
    • environment (String) (defaults to: )
    • user (String) (defaults to: )
    • session (String) (defaults to: )
    • entity_type (String) (defaults to: )
  • #session_entity_type_path(project: , location: , session: , entity_type: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • session (String) (defaults to: )
    • entity_type (String) (defaults to: )
  • #session_entity_type_path(project: , location: , environment: , user: , session: , entity_type: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • environment (String) (defaults to: )
    • user (String) (defaults to: )
    • session (String) (defaults to: )
    • entity_type (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 254

def session_entity_type_path **args
  resources = {
    "entity_type:project:session" => (proc do |project:, session:, entity_type:|
      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}/entityTypes/#{entity_type}"
    end),
    "entity_type:environment:project:session:user" => (proc do |project:, environment:, user:, session:, entity_type:|
      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}/entityTypes/#{entity_type}"
    end),
    "entity_type:location:project:session" => (proc do |project:, location:, session:, entity_type:|
      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}/entityTypes/#{entity_type}"
    end),
    "entity_type:environment:location:project:session:user" => (proc do |project:, location:, environment:, user:, session:, entity_type:|
      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}/entityTypes/#{entity_type}"
    end)
  }

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

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

Create a fully-qualified Session resource string.

Overloads:

  • #session_path(project: , session: ) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

    • project (String) (defaults to: )
    • session (String) (defaults to: )
  • #session_path(project: , environment: , user: , session: ) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

    • project (String) (defaults to: )
    • environment (String) (defaults to: )
    • user (String) (defaults to: )
    • session (String) (defaults to: )
  • #session_path(project: , location: , session: ) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • session (String) (defaults to: )
  • #session_path(project: , location: , environment: , user: , session: ) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 173

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

      "projects/#{project}/agent/sessions/#{session}"
    end),
    "environment:project:session:user" => (proc do |project:, environment:, user:, session:|
      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? "/"

      "projects/#{project}/agent/environments/#{environment}/users/#{user}/sessions/#{session}"
    end),
    "location:project:session" => (proc do |project:, location:, session:|
      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/sessions/#{session}"
    end),
    "environment:location:project:session:user" => (proc do |project:, location:, environment:, user:, session:|
      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? "/"

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

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