Class: Twilio::REST::Preview::Understand::AssistantContext::TaskContext::TaskActionsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/understand/assistant/task/task_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, task_sid) ⇒ TaskActionsContext

Initialize the TaskActionsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The unique ID of the parent Assistant.

  • task_sid (String)

    The unique ID of the Task.


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

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

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

Instance Method Details

#fetchTaskActionsInstance

Fetch the TaskActionsInstance

Returns:


94
95
96
97
98
99
100
101
102
103
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 94

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

  TaskActionsInstance.new(
      @version,
      payload,
      assistant_sid: @solution[:assistant_sid],
      task_sid: @solution[:task_sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


132
133
134
135
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 132

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

#to_sObject

Provide a user friendly representation


125
126
127
128
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 125

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

#update(actions: :unset) ⇒ TaskActionsInstance

Update the TaskActionsInstance

Parameters:

  • actions (Hash) (defaults to: :unset)

    The JSON actions that instruct the Assistant how to perform this task.

Returns:


110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 110

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

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

  TaskActionsInstance.new(
      @version,
      payload,
      assistant_sid: @solution[:assistant_sid],
      task_sid: @solution[:task_sid],
  )
end