class Twilio::REST::Preview::Understand::AssistantContext::TaskContext

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 help@twilio.com.

Public Class Methods

new(version, assistant_sid, sid) click to toggle source

Initialize the TaskContext @param [Version] version Version that contains the resource @param [String] assistant_sid The unique ID of the Assistant. @param [String] sid A 34 character string that uniquely identifies this

resource.

@return [TaskContext] TaskContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
182 def initialize(version, assistant_sid, sid)
183   super(version)
184 
185   # Path Solution
186   @solution = {assistant_sid: assistant_sid, sid: sid, }
187   @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:sid]}"
188 
189   # Dependents
190   @fields = nil
191   @samples = nil
192   @task_actions = nil
193   @statistics = nil
194 end

Public Instance Methods

delete() click to toggle source

Delete the TaskInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
232 def delete
233    @version.delete('DELETE', @uri)
234 end
fetch() click to toggle source

Fetch the TaskInstance @return [TaskInstance] Fetched TaskInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
199 def fetch
200   payload = @version.fetch('GET', @uri)
201 
202   TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
203 end
fields(sid=:unset) click to toggle source

Access the fields @return [FieldList] @return [FieldContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
240 def fields(sid=:unset)
241   raise ArgumentError, 'sid cannot be nil' if sid.nil?
242 
243   if sid != :unset
244     return FieldContext.new(@version, @solution[:assistant_sid], @solution[:sid], sid, )
245   end
246 
247   unless @fields
248     @fields = FieldList.new(
249         @version,
250         assistant_sid: @solution[:assistant_sid],
251         task_sid: @solution[:sid],
252     )
253   end
254 
255   @fields
256 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
305 def inspect
306   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
307   "#<Twilio.Preview.Understand.TaskContext #{context}>"
308 end
samples(sid=:unset) click to toggle source

Access the samples @return [SampleList] @return [SampleContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
262 def samples(sid=:unset)
263   raise ArgumentError, 'sid cannot be nil' if sid.nil?
264 
265   if sid != :unset
266     return SampleContext.new(@version, @solution[:assistant_sid], @solution[:sid], sid, )
267   end
268 
269   unless @samples
270     @samples = SampleList.new(
271         @version,
272         assistant_sid: @solution[:assistant_sid],
273         task_sid: @solution[:sid],
274     )
275   end
276 
277   @samples
278 end
statistics() click to toggle source

Access the statistics @return [TaskStatisticsList] @return [TaskStatisticsContext]

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
292 def statistics
293   TaskStatisticsContext.new(@version, @solution[:assistant_sid], @solution[:sid], )
294 end
task_actions() click to toggle source

Access the task_actions @return [TaskActionsList] @return [TaskActionsContext]

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
284 def task_actions
285   TaskActionsContext.new(@version, @solution[:assistant_sid], @solution[:sid], )
286 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
298 def to_s
299   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
300   "#<Twilio.Preview.Understand.TaskContext #{context}>"
301 end
update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset) click to toggle source

Update the TaskInstance @param [String] friendly_name A user-provided string that identifies this

resource. It is non-unique and can up to 255 characters long.

@param [String] unique_name A user-provided string that uniquely identifies this

resource as an alternative to the sid. Unique up to 64 characters long.

@param [Hash] actions A user-provided JSON object encoded as a string to specify

the actions for this task. It is optional and non-unique.

@param [String] actions_url User-provided HTTP endpoint where from the assistant

fetches actions

@return [TaskInstance] Updated TaskInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/task.rb
216 def update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset)
217   data = Twilio::Values.of({
218       'FriendlyName' => friendly_name,
219       'UniqueName' => unique_name,
220       'Actions' => Twilio.serialize_object(actions),
221       'ActionsUrl' => actions_url,
222   })
223 
224   payload = @version.update('POST', @uri, data: data)
225 
226   TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
227 end