Module: Google::Cloud::Dialogflow::CX::V3::Sessions::Paths

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

Overview

Path helper methods for the Sessions API.

Instance Method Summary collapse

Instance Method Details

#entity_type_path(project:, location:, agent:, entity_type:) ⇒ ::String

Create a fully-qualified EntityType resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}

Parameters:

  • project (String)
  • location (String)
  • agent (String)
  • entity_type (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


41
42
43
44
45
46
47
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 41

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

  "projects/#{project}/locations/#{location}/agents/#{agent}/entityTypes/#{entity_type}"
end

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

Create a fully-qualified Intent resource string.

The resource will be in the following format:

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

Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


62
63
64
65
66
67
68
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 62

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

  "projects/#{project}/locations/#{location}/agents/#{agent}/intents/#{intent}"
end

#page_path(project:, location:, agent:, flow:, page:) ⇒ ::String

Create a fully-qualified Page resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}

Parameters:

  • project (String)
  • location (String)
  • agent (String)
  • flow (String)
  • page (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


84
85
86
87
88
89
90
91
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 84

def page_path project:, location:, agent:, flow:, page:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "agent cannot contain /" if agent.to_s.include? "/"
  raise ::ArgumentError, "flow cannot contain /" if flow.to_s.include? "/"

  "projects/#{project}/locations/#{location}/agents/#{agent}/flows/#{flow}/pages/#{page}"
end

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

Create a fully-qualified SessionEntityType resource string.

Overloads:

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

    The resource will be in the following format:

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

    Parameters:

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

    The resource will be in the following format:

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

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 169

def session_entity_type_path **args
  resources = {
    "agent:entity_type:location:project:session" => (proc do |project:, location:, agent:, 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, "agent cannot contain /" if agent.to_s.include? "/"
      raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agents/#{agent}/sessions/#{session}/entityTypes/#{entity_type}"
    end),
    "agent:entity_type:environment:location:project:session" => (proc do |project:, location:, agent:, environment:, 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, "agent cannot contain /" if agent.to_s.include? "/"
      raise ::ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
      raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"

      "projects/#{project}/locations/#{location}/agents/#{agent}/environments/#{environment}/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: , location: , agent: , session: ) ⇒ ::String #session_path(project: , location: , agent: , environment: , session: ) ⇒ ::String

Create a fully-qualified Session resource string.

Overloads:

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

    The resource will be in the following format:

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

    Parameters:

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

    The resource will be in the following format:

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

    Parameters:

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

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 118

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

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

      "projects/#{project}/locations/#{location}/agents/#{agent}/environments/#{environment}/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

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

Create a fully-qualified Version resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}

Parameters:

  • project (String)
  • location (String)
  • agent (String)
  • flow (String)
  • version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


209
210
211
212
213
214
215
216
# File 'lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb', line 209

def version_path project:, location:, agent:, flow:, version:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "agent cannot contain /" if agent.to_s.include? "/"
  raise ::ArgumentError, "flow cannot contain /" if flow.to_s.include? "/"

  "projects/#{project}/locations/#{location}/agents/#{agent}/flows/#{flow}/versions/#{version}"
end