Class: Twilio::REST::Studio::V2::FlowContext::ExecutionContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Studio::V2::FlowContext::ExecutionContext
- Defined in:
- lib/twilio-ruby/rest/studio/v2/flow/execution.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_context.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step/execution_step_context.rb
Defined Under Namespace
Classes: ExecutionContextContext, ExecutionContextInstance, ExecutionContextInstanceMetadata, ExecutionContextList, ExecutionContextListResponse, ExecutionContextPage, ExecutionContextPageMetadata, ExecutionStepContext, ExecutionStepInstance, ExecutionStepInstanceMetadata, ExecutionStepList, ExecutionStepListResponse, ExecutionStepPage, ExecutionStepPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ExecutionInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ExecutionInstanceMetadata.
-
#execution_context ⇒ ExecutionContextList, ExecutionContextContext
Access the execution_context.
-
#fetch ⇒ ExecutionInstance
Fetch the ExecutionInstance.
-
#fetch_with_metadata ⇒ ExecutionInstance
Fetch the ExecutionInstanceMetadata.
-
#initialize(version, flow_sid, sid) ⇒ ExecutionContext
constructor
Initialize the ExecutionContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#steps(sid = :unset) ⇒ ExecutionStepList, ExecutionStepContext
Access the steps.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(status: nil) ⇒ ExecutionInstance
Update the ExecutionInstance.
-
#update_with_metadata(status: nil) ⇒ ExecutionInstance
Update the ExecutionInstanceMetadata.
Constructor Details
#initialize(version, flow_sid, sid) ⇒ ExecutionContext
Initialize the ExecutionContext
256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 256 def initialize(version, flow_sid, sid) super(version) # Path Solution @solution = { flow_sid: flow_sid, sid: sid, } @uri = "/Flows/#{@solution[:flow_sid]}/Executions/#{@solution[:sid]}" # Dependents @execution_context = nil @steps = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the ExecutionInstance
271 272 273 274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 271 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the ExecutionInstanceMetadata
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 284 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) execution_instance = ExecutionInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ExecutionInstanceMetadata.new(@version, execution_instance, response.headers, response.status_code) end |
#execution_context ⇒ ExecutionContextList, ExecutionContextContext
Access the execution_context
410 411 412 413 414 415 416 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 410 def execution_context ExecutionContextContext.new( @version, @solution[:flow_sid], @solution[:sid] ) end |
#fetch ⇒ ExecutionInstance
Fetch the ExecutionInstance
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 303 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ExecutionInstance.new( @version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ExecutionInstance
Fetch the ExecutionInstanceMetadata
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 323 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) execution_instance = ExecutionInstance.new( @version, response.body, flow_sid: @solution[:flow_sid], sid: @solution[:sid], ) ExecutionInstanceMetadata.new( @version, execution_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
446 447 448 449 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 446 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.ExecutionContext #{context}>" end |
#steps(sid = :unset) ⇒ ExecutionStepList, ExecutionStepContext
Access the steps
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 421 def steps(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ExecutionStepContext.new(@version, @solution[:flow_sid], @solution[:sid],sid ) end unless @steps @steps = ExecutionStepList.new( @version, flow_sid: @solution[:flow_sid], execution_sid: @solution[:sid], ) end @steps end |
#to_s ⇒ Object
Provide a user friendly representation
439 440 441 442 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 439 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.ExecutionContext #{context}>" end |
#update(status: nil) ⇒ ExecutionInstance
Update the ExecutionInstance
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 350 def update( status: nil ) data = Twilio::Values.of({ 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ExecutionInstance.new( @version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], ) end |
#update_with_metadata(status: nil) ⇒ ExecutionInstance
Update the ExecutionInstanceMetadata
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 377 def ( status: nil ) data = Twilio::Values.of({ 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) execution_instance = ExecutionInstance.new( @version, response.body, flow_sid: @solution[:flow_sid], sid: @solution[:sid], ) ExecutionInstanceMetadata.new( @version, execution_instance, response.headers, response.status_code ) end |