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.



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 271

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

#contextInteractionChannelContext

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

Returns:



295
296
297
298
299
300
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 295

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

#error_codeString

Returns The Twilio error code for a failed channel.

Returns:

  • (String)

    The Twilio error code for a failed channel.



328
329
330
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 328

def error_code
    @properties['error_code']
end

#error_messageString

Returns The error message for a failed channel.

Returns:

  • (String)

    The error message for a failed channel.



334
335
336
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 334

def error_message
    @properties['error_message']
end

#fetchInteractionChannelInstance

Fetch the InteractionChannelInstance

Returns:



353
354
355
356
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 353

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



397
398
399
400
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 397

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

#interaction_sidString

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.



310
311
312
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 310

def interaction_sid
    @properties['interaction_sid']
end

#invitesinvites

Access the invites

Returns:



377
378
379
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 377

def invites
    context.invites
end

Returns:

  • (Hash)


346
347
348
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 346

def links
    @properties['links']
end

#participantsparticipants

Access the participants

Returns:



384
385
386
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 384

def participants
    context.participants
end

#sidString

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.



304
305
306
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 304

def sid
    @properties['sid']
end

#statusChannelStatus

Returns:

  • (ChannelStatus)


322
323
324
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 322

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



390
391
392
393
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 390

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

#typeType

Returns:

  • (Type)


316
317
318
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 316

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:



363
364
365
366
367
368
369
370
371
372
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 363

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

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

#urlString

Returns:

  • (String)


340
341
342
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 340

def url
    @properties['url']
end