Class: Twilio::REST::FlexApi::V1::InteractionInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ InteractionInstance

Initialize the InteractionInstance

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 Interaction resource.

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

    The SID of the Call resource to fetch.



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 359

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'channel' => payload['channel'],
        'routing' => payload['routing'],
        'url' => payload['url'],
        'links' => payload['links'],
        'interaction_context_sid' => payload['interaction_context_sid'],
        'webhook_ttid' => payload['webhook_ttid'],
    }

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

Instance Method Details

#channel ⇒ Hash

Returns A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the Outbound SMS and inbound (API-initiated) Channel object examples.

Returns:

  • (Hash) —

    A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the Outbound SMS and inbound (API-initiated) Channel object examples.



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

def channel
    @properties['channel']
end

#channels ⇒ channels

Access the channels

Returns:



456
457
458
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 456

def channels
    context.channels
end

#context ⇒ InteractionContext

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

Returns:



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

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

#fetch ⇒ InteractionInstance

Fetch the InteractionInstance

Returns:



435
436
437
438
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 435

def fetch

    context.fetch
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



469
470
471
472
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 469

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

#interaction_context_sid ⇒ String

Returns:

  • (String)


422
423
424
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 422

def interaction_context_sid
    @properties['interaction_context_sid']
end

Returns:

  • (Hash)


416
417
418
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 416

def links
    @properties['links']
end

#routing ⇒ Hash

Returns A JSON Object representing the routing rules for the Interaction Channel. See Outbound SMS Example for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see Known Task Attributes.

Returns:

  • (Hash) —

    A JSON Object representing the routing rules for the Interaction Channel. See Outbound SMS Example for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see Known Task Attributes.



404
405
406
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 404

def routing
    @properties['routing']
end

#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.



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

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



462
463
464
465
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 462

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

#update(webhook_ttid: :unset) ⇒ InteractionInstance

Update the InteractionInstance

Parameters:

  • webhook_ttid (String) (defaults to: :unset) —

    The unique identifier for Interaction level webhook

Returns:



444
445
446
447
448
449
450
451
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 444

def update(
  webhook_ttid: :unset
)

    context.update(
        webhook_ttid: webhook_ttid, 
    )
end

#url ⇒ String

Returns:

  • (String)


410
411
412
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 410

def url
    @properties['url']
end

#webhook_ttid ⇒ String

Returns:

  • (String)


428
429
430
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 428

def webhook_ttid
    @properties['webhook_ttid']
end