Class: Twilio::REST::Preview::Understand::AssistantContext::IntentContext::IntentActionsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, assistant_sid, intent_sid) ⇒ IntentActionsContext

Initialize the IntentActionsContext



83
84
85
86
87
88
89
# File 'lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb', line 83

def initialize(version, assistant_sid, intent_sid)
  super(version)

  # Path Solution
  @solution = {assistant_sid: assistant_sid, intent_sid: intent_sid, }
  @uri = "/Assistants/#{@solution[:assistant_sid]}/Intents/#{@solution[:intent_sid]}/Actions"
end

Instance Method Details

#fetchIntentActionsInstance

Fetch a IntentActionsInstance



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb', line 94

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  IntentActionsInstance.new(
      @version,
      payload,
      assistant_sid: @solution[:assistant_sid],
      intent_sid: @solution[:intent_sid],
  )
end

#to_sObject

Provide a user friendly representation



135
136
137
138
# File 'lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb', line 135

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Understand.IntentActionsContext #{context}>"
end

#update(actions: :unset) ⇒ IntentActionsInstance

Update the IntentActionsInstance



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_actions.rb', line 116

def update(actions: :unset)
  data = Twilio::Values.of({'Actions' => Twilio.serialize_object(actions), })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  IntentActionsInstance.new(
      @version,
      payload,
      assistant_sid: @solution[:assistant_sid],
      intent_sid: @solution[:intent_sid],
  )
end