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
264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 264 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
279 280 281 282 283 284 285 286 287 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 279 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
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 292 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
418 419 420 421 422 423 424 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 418 def execution_context ExecutionContextContext.new( @version, @solution[:flow_sid], @solution[:sid] ) end |
#fetch ⇒ ExecutionInstance
Fetch the ExecutionInstance
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 311 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
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 331 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
454 455 456 457 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 454 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.ExecutionContext #{context}>" end |
#steps(sid = :unset) ⇒ ExecutionStepList, ExecutionStepContext
Access the steps
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 429 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
447 448 449 450 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 447 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.ExecutionContext #{context}>" end |
#update(status: nil) ⇒ ExecutionInstance
Update the ExecutionInstance
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 358 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
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 385 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 |