Class: Twilio::REST::FlexApi::V1::InteractionContext::InteractionChannelInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, interaction_sid: nil, sid: nil) ⇒ InteractionChannelInstance

Initialize the InteractionChannelInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this InteractionChannel resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 506

def initialize(version, payload , interaction_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'interaction_sid' => payload['interaction_sid'],
        'type' => payload['type'],
        'status' => payload['status'],
        'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
        'error_message' => payload['error_message'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'interaction_sid' => interaction_sid  || @properties['interaction_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#context ⇒ InteractionChannelContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



531
532
533
534
535
536
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 531

def context
    unless @instance_context
        @instance_context = InteractionChannelContext.new(@version , @params['interaction_sid'], @params['sid'])
    end
    @instance_context
end

#error_code ⇒ String

Returns The Twilio error code for a failed channel.

Returns:

  • (String) —

    The Twilio error code for a failed channel.



564
565
566
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 564

def error_code
    @properties['error_code']
end

#error_message ⇒ String

Returns The error message for a failed channel.

Returns:

  • (String) —

    The error message for a failed channel.



570
571
572
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 570

def error_message
    @properties['error_message']
end

#fetch ⇒ InteractionChannelInstance

Fetch the InteractionChannelInstance

Returns:



589
590
591
592
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 589

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



640
641
642
643
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 640

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
end

#interaction_sid ⇒ String

Returns The unique string created by Twilio to identify an Interaction resource, prefixed with KD.

Returns:

  • (String) —

    The unique string created by Twilio to identify an Interaction resource, prefixed with KD.



546
547
548
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 546

def interaction_sid
    @properties['interaction_sid']
end

#invites ⇒ invites

Access the invites

Returns:



613
614
615
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 613

def invites
    context.invites
end

Returns:

  • (Hash)


582
583
584
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 582

def links
    @properties['links']
end

#participants ⇒ participants

Access the participants

Returns:



627
628
629
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 627

def participants
    context.participants
end

#sid ⇒ String

Returns The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO.

Returns:

  • (String) —

    The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO.



540
541
542
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 540

def sid
    @properties['sid']
end

#status ⇒ ChannelStatus

Returns:

  • (ChannelStatus)


558
559
560
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 558

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



633
634
635
636
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 633

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
end

#transfers ⇒ transfers

Access the transfers

Returns:



620
621
622
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 620

def transfers
    context.transfers
end

#type ⇒ Type

Returns:

  • (Type)


552
553
554
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 552

def type
    @properties['type']
end

#update(status: nil, routing: :unset) ⇒ InteractionChannelInstance

Update the InteractionChannelInstance

Parameters:

  • status (UpdateChannelStatus) (defaults to: nil)
  • routing (Object) (defaults to: :unset) —

    It changes the state of associated tasks. Routing status is required, When the channel status is set to inactive. Allowed Value for routing status is closed. Otherwise Optional, if not specified, all tasks will be set to wrapping.

Returns:



599
600
601
602
603
604
605
606
607
608
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 599

def update(
  status: nil, 
  routing: :unset
)

    context.update(
        status: status, 
        routing: routing, 
    )
end

#url ⇒ String

Returns:

  • (String)


576
577
578
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 576

def url
    @properties['url']
end