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

Inherits:
InstanceResource
  • 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, payload, assistant_sid: nil, task_sid: nil) ⇒ TaskActionsInstance

Initialize the TaskActionsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • assistant_sid (String) (defaults to: nil)

    The unique ID of the parent Assistant.

  • task_sid (String) (defaults to: nil)

    The unique ID of the Task.


148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 148

def initialize(version, payload, assistant_sid: nil, task_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'assistant_sid' => payload['assistant_sid'],
      'task_sid' => payload['task_sid'],
      'url' => payload['url'],
      'data' => payload['data'],
  }

  # Context
  @instance_context = nil
  @params = {'assistant_sid' => assistant_sid, 'task_sid' => task_sid, }
end

Instance Method Details

#account_sidString

Returns The unique ID of the Account that created this Field.

Returns:

  • (String)

    The unique ID of the Account that created this Field.


178
179
180
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 178

def 
  @properties['account_sid']
end

#assistant_sidString

Returns The unique ID of the parent Assistant.

Returns:

  • (String)

    The unique ID of the parent Assistant.


184
185
186
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 184

def assistant_sid
  @properties['assistant_sid']
end

#contextTaskActionsContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


169
170
171
172
173
174
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 169

def context
  unless @instance_context
    @instance_context = TaskActionsContext.new(@version, @params['assistant_sid'], @params['task_sid'], )
  end
  @instance_context
end

#dataHash

Returns The data.

Returns:

  • (Hash)

    The data


202
203
204
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 202

def data
  @properties['data']
end

#fetchTaskActionsInstance

Fetch the TaskActionsInstance

Returns:


209
210
211
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 209

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


231
232
233
234
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 231

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.Understand.TaskActionsInstance #{values}>"
end

#task_sidString

Returns The unique ID of the Task.

Returns:

  • (String)

    The unique ID of the Task.


190
191
192
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 190

def task_sid
  @properties['task_sid']
end

#to_sObject

Provide a user friendly representation


224
225
226
227
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 224

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Preview.Understand.TaskActionsInstance #{values}>"
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:


218
219
220
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 218

def update(actions: :unset)
  context.update(actions: actions, )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url


196
197
198
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb', line 196

def url
  @properties['url']
end