Class: Twilio::REST::Preview::Understand::AssistantContext::TaskContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Understand::AssistantContext::TaskContext
- Defined in:
- lib/twilio-ruby/rest/preview/understand/assistant/task.rb,
lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb,
lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb,
lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb,
lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.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].
Defined Under Namespace
Classes: FieldContext, FieldInstance, FieldList, FieldPage, SampleContext, SampleInstance, SampleList, SamplePage, TaskActionsContext, TaskActionsInstance, TaskActionsList, TaskActionsPage, TaskStatisticsContext, TaskStatisticsInstance, TaskStatisticsList, TaskStatisticsPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the TaskInstance.
-
#fetch ⇒ TaskInstance
Fetch the TaskInstance.
-
#fields(sid = :unset) ⇒ FieldList, FieldContext
Access the fields.
-
#initialize(version, assistant_sid, sid) ⇒ TaskContext
constructor
Initialize the TaskContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#samples(sid = :unset) ⇒ SampleList, SampleContext
Access the samples.
-
#statistics ⇒ TaskStatisticsList, TaskStatisticsContext
Access the statistics.
-
#task_actions ⇒ TaskActionsList, TaskActionsContext
Access the task_actions.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset) ⇒ TaskInstance
Update the TaskInstance.
Constructor Details
#initialize(version, assistant_sid, sid) ⇒ TaskContext
Initialize the TaskContext
166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 166 def initialize(version, assistant_sid, sid) super(version) # Path Solution @solution = { assistant_sid: assistant_sid, sid: sid, } @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:sid]}" # Dependents @task_actions = nil @statistics = nil @samples = nil @fields = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the TaskInstance
182 183 184 185 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 182 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ TaskInstance
Fetch the TaskInstance
190 191 192 193 194 195 196 197 198 199 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 190 def fetch payload = @version.fetch('GET', @uri) TaskInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end |
#fields(sid = :unset) ⇒ FieldList, FieldContext
Access the fields
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 276 def fields(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FieldContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) end unless @fields @fields = FieldList.new( @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) end @fields end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
301 302 303 304 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 301 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.TaskContext #{context}>" end |
#samples(sid = :unset) ⇒ SampleList, SampleContext
Access the samples
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 257 def samples(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SampleContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) end unless @samples @samples = SampleList.new( @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) end @samples end |
#statistics ⇒ TaskStatisticsList, TaskStatisticsContext
Access the statistics
246 247 248 249 250 251 252 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 246 def statistics TaskStatisticsContext.new( @version, @solution[:assistant_sid], @solution[:sid] ) end |
#task_actions ⇒ TaskActionsList, TaskActionsContext
Access the task_actions
235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 235 def task_actions TaskActionsContext.new( @version, @solution[:assistant_sid], @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
294 295 296 297 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 294 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.TaskContext #{context}>" end |
#update(friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset) ⇒ TaskInstance
Update the TaskInstance
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/task.rb', line 208 def update( friendly_name: :unset, unique_name: :unset, actions: :unset, actions_url: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'Actions' => Twilio.serialize_object(actions), 'ActionsUrl' => actions_url, }) payload = @version.update('POST', @uri, data: data) TaskInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end |