Class: Twilio::REST::Autopilot::V1::AssistantContext::TaskContext::TaskActionsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/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 SID of the Assistant that is the parent of the Task for which the task actions to fetch were defined.

  • task_sid (String)

    The SID of the Task for which the task actions to fetch were defined.


91
92
93
94
95
96
97
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 91

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:


102
103
104
105
106
107
108
109
110
111
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 102

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


141
142
143
144
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 141

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

#to_sObject

Provide a user friendly representation


134
135
136
137
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 134

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

#update(actions: :unset) ⇒ TaskActionsInstance

Update the TaskActionsInstance

Parameters:

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

    The JSON string that specifies the actions that instruct the Assistant on how to perform the task.

Returns:


119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb', line 119

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