Class: Twilio::REST::Studio::V2::FlowContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Studio::V2::FlowContext
- Defined in:
- lib/twilio-ruby/rest/studio/v2/flow.rb,
lib/twilio-ruby/rest/studio/v2/flow/execution.rb,
lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb,
lib/twilio-ruby/rest/studio/v2/flow/flow_test_user.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: ExecutionContext, ExecutionInstance, ExecutionInstanceMetadata, ExecutionList, ExecutionListResponse, ExecutionPage, ExecutionPageMetadata, FlowRevisionContext, FlowRevisionInstance, FlowRevisionInstanceMetadata, FlowRevisionList, FlowRevisionListResponse, FlowRevisionPage, FlowRevisionPageMetadata, FlowTestUserContext, FlowTestUserInstance, FlowTestUserInstanceMetadata, FlowTestUserList, FlowTestUserListResponse, FlowTestUserPage, FlowTestUserPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the FlowInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the FlowInstanceMetadata.
-
#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext
Access the executions.
-
#fetch ⇒ FlowInstance
Fetch the FlowInstance.
-
#fetch_with_metadata ⇒ FlowInstance
Fetch the FlowInstanceMetadata.
-
#initialize(version, sid) ⇒ FlowContext
constructor
Initialize the FlowContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#revisions(revision = :unset) ⇒ FlowRevisionList, FlowRevisionContext
Access the revisions.
-
#test_users ⇒ FlowTestUserList, FlowTestUserContext
Access the test_users.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstance.
-
#update_with_metadata(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ FlowContext
Initialize the FlowContext
233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 233 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Flows/#{@solution[:sid]}" # Dependents @executions = nil @test_users = nil @revisions = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the FlowInstance
249 250 251 252 253 254 255 256 257 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 249 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 FlowInstanceMetadata
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 262 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) flow_instance = FlowInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) FlowInstanceMetadata.new(@version, flow_instance, response.headers, response.status_code) end |
#executions(sid = :unset) ⇒ ExecutionList, ExecutionContext
Access the executions
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 402 def executions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ExecutionContext.new(@version, @solution[:sid],sid ) end unless @executions @executions = ExecutionList.new( @version, flow_sid: @solution[:sid], ) end @executions end |
#fetch ⇒ FlowInstance
Fetch the FlowInstance
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 281 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) FlowInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ FlowInstance
Fetch the FlowInstanceMetadata
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 300 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) flow_instance = FlowInstance.new( @version, response.body, sid: @solution[:sid], ) FlowInstanceMetadata.new( @version, flow_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
456 457 458 459 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 456 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.FlowContext #{context}>" end |
#revisions(revision = :unset) ⇒ FlowRevisionList, FlowRevisionContext
Access the revisions
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 431 def revisions(revision=:unset) raise ArgumentError, 'revision cannot be nil' if revision.nil? if revision != :unset return FlowRevisionContext.new(@version, @solution[:sid],revision ) end unless @revisions @revisions = FlowRevisionList.new( @version, sid: @solution[:sid], ) end @revisions end |
#test_users ⇒ FlowTestUserList, FlowTestUserContext
Access the test_users
421 422 423 424 425 426 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 421 def test_users FlowTestUserContext.new( @version, @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
449 450 451 452 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 449 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Studio.V2.FlowContext #{context}>" end |
#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstance
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 329 def update( status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset ) data = Twilio::Values.of({ 'Status' => status, 'FriendlyName' => friendly_name, 'Definition' => Twilio.serialize_object(definition), 'CommitMessage' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) FlowInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance
Update the FlowInstanceMetadata
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 364 def ( status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset ) data = Twilio::Values.of({ 'Status' => status, 'FriendlyName' => friendly_name, 'Definition' => Twilio.serialize_object(definition), 'CommitMessage' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) flow_instance = FlowInstance.new( @version, response.body, sid: @solution[:sid], ) FlowInstanceMetadata.new( @version, flow_instance, response.headers, response.status_code ) end |