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

  • interaction_sid (String) (defaults to: nil)

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

  • sid (String) (defaults to: nil)

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


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

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'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'interaction_sid' => 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:


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

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

#fetchInteractionChannelInstance

Fetch the InteractionChannelInstance

Returns:


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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


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

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

#interaction_sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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:


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

def invites
  context.invites
end

Returns The links.

Returns:

  • (String)

    The links


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

def links
  @properties['links']
end

#participantsparticipants

Access the participants

Returns:


362
363
364
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 362

def participants
  context.participants
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


368
369
370
371
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb', line 368

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

#typeinteraction_channel.Type

Returns The Interaction Channel's type.

Returns:

  • (interaction_channel.Type)

    The Interaction Channel's 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 (interaction_channel.Status) (defaults to: nil)

    Required. Indicates the Interaction channel's status. When a channel is set to `closed`, all tasks are put in the `wrapping` state by default unless the Routing status is set to `closed` in which case the tasks will be `completed`. Value: `closed`.

  • routing (Hash) (defaults to: :unset)

    Optional. The state of associated tasks. If not specified, all tasks will be set to `wrapping`.

Returns:


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

def update(status: nil, routing: :unset)
  context.update(status: status, routing: routing, )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url


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

def url
  @properties['url']
end