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.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 211

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

#channelHash

Returns A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples.

Returns:



249
250
251
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 249

def channel
    @properties['channel']
end

#channelschannels

Access the channels

Returns:



307
308
309
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 307

def channels
    context.channels
end

#contextInteractionContext

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

Returns:



234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 234

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

#fetchInteractionInstance

Fetch the InteractionInstance

Returns:



286
287
288
289
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 286

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#interaction_context_sidString

Returns:

  • (String)


273
274
275
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 273

def interaction_context_sid
    @properties['interaction_context_sid']
end

Returns:

  • (Hash)


267
268
269
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 267

def links
    @properties['links']
end

#routingHash

Returns A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) 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](www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes).

Returns:



255
256
257
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 255

def routing
    @properties['routing']
end

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



243
244
245
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 243

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



313
314
315
316
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 313

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:



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

def update(
    webhook_ttid: :unset
)

    context.update(
        webhook_ttid: webhook_ttid, 
    )
end

#urlString

Returns:

  • (String)


261
262
263
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 261

def url
    @properties['url']
end

#webhook_ttidString

Returns:

  • (String)


279
280
281
# File 'lib/twilio-ruby/rest/flex_api/v1/interaction.rb', line 279

def webhook_ttid
    @properties['webhook_ttid']
end