Module: Google::Cloud::Dialogflow::V2::Contexts::Paths
- Extended by:
- Paths
- Defined in:
- lib/google/cloud/dialogflow/v2/contexts/paths.rb
Overview
Path helper methods for the Contexts API.
Instance Method Summary collapse
-
#context_path(**args) ⇒ ::String
Create a fully-qualified Context resource string.
-
#session_path(**args) ⇒ ::String
Create a fully-qualified Session resource string.
Instance Method Details
#context_path(project: , session: , context: ) ⇒ ::String #context_path(project: , environment: , user: , session: , context: ) ⇒ ::String
Create a fully-qualified Context resource string.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/google/cloud/dialogflow/v2/contexts/paths.rb', line 51 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) } 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
Create a fully-qualified Session resource string.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/google/cloud/dialogflow/v2/contexts/paths.rb', line 96 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) } resource = resources[args.keys.sort.join(":")] raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? resource.call(**args) end |