Module: Google::Cloud::Dialogflow::V2::Sessions::Paths
- Extended by:
- Paths
- Defined in:
- lib/google/cloud/dialogflow/v2/sessions/paths.rb
Overview
Path helper methods for the Sessions API.
Instance Method Summary collapse
-
#context_path(project:, session:, context:) ⇒ String
Create a fully-qualified Context resource string.
-
#session_entity_type_path(project:, session:, entity_type:) ⇒ String
Create a fully-qualified SessionEntityType resource string.
-
#session_path(**args) ⇒ String
Create a fully-qualified Session resource string.
Instance Method Details
#context_path(project:, session:, context:) ⇒ String
Create a fully-qualified Context resource string.
The resource will be in the following format:
projects/{project}/agent/sessions/{session}/contexts/{context}
39 40 41 42 43 44 |
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 39 def context_path 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 |
#session_entity_type_path(project:, session:, entity_type:) ⇒ String
Create a fully-qualified SessionEntityType resource string.
The resource will be in the following format:
projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}
99 100 101 102 103 104 |
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 99 def session_entity_type_path 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 |
#session_path(project: , location: , session: ) ⇒ String #session_path(project: , session: ) ⇒ String
Create a fully-qualified Session resource string.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/google/cloud/dialogflow/v2/sessions/paths.rb', line 67 def session_path **args resources = { "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), "project:session" => (proc do |project:, session:| raise ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/agent/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 |