Class: Twilio::REST::FlexApi::V1::FlexFlowInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the FlexFlowInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the FlexFlow resource to fetch.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 333

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'sid' => payload['sid'],
      'friendly_name' => payload['friendly_name'],
      'chat_service_sid' => payload['chat_service_sid'],
      'channel_type' => payload['channel_type'],
      'contact_identity' => payload['contact_identity'],
      'enabled' => payload['enabled'],
      'integration_type' => payload['integration_type'],
      'integration' => payload['integration'],
      'long_lived' => payload['long_lived'],
      'janitor_enabled' => payload['janitor_enabled'],
      'url' => payload['url'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



372
373
374
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 372

def 
  @properties['account_sid']
end

#channel_typeflex_flow.ChannelType

Returns The channel type.

Returns:

  • (flex_flow.ChannelType)

    The channel type



408
409
410
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 408

def channel_type
  @properties['channel_type']
end

#chat_service_sidString

Returns The SID of the chat service.

Returns:

  • (String)

    The SID of the chat service



402
403
404
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 402

def chat_service_sid
  @properties['chat_service_sid']
end

#contact_identityString

Returns The channel contact’s Identity.

Returns:

  • (String)

    The channel contact’s Identity



414
415
416
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 414

def contact_identity
  @properties['contact_identity']
end

#contextFlexFlowContext

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

Returns:



363
364
365
366
367
368
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 363

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created



378
379
380
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 378

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the FlexFlowInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



526
527
528
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 526

def delete
  context.delete
end

#enabledBoolean

Returns Whether the FlexFlow is enabled.

Returns:

  • (Boolean)

    Whether the FlexFlow is enabled



420
421
422
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 420

def enabled
  @properties['enabled']
end

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource



396
397
398
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 396

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#integrationHash

Returns An object that contains specific parameters for the integration.

Returns:

  • (Hash)

    An object that contains specific parameters for the integration



432
433
434
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 432

def integration
  @properties['integration']
end

#integration_typeflex_flow.IntegrationType

Returns The integration type.

Returns:

  • (flex_flow.IntegrationType)

    The integration type



426
427
428
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 426

def integration_type
  @properties['integration_type']
end

#janitor_enabledBoolean

Returns Remove active Proxy sessions if the corresponding Task is deleted.

Returns:

  • (Boolean)

    Remove active Proxy sessions if the corresponding Task is deleted.



444
445
446
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 444

def janitor_enabled
  @properties['janitor_enabled']
end

#long_livedBoolean

Returns Re-use this chat channel for future interactions with a contact.

Returns:

  • (Boolean)

    Re-use this chat channel for future interactions with a contact



438
439
440
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 438

def long_lived
  @properties['long_lived']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



532
533
534
535
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 532

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

#update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset) ⇒ FlexFlowInstance

Update the FlexFlowInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the FlexFlow resource.

  • chat_service_sid (String) (defaults to: :unset)

    The SID of the chat service.

  • channel_type (flex_flow.ChannelType) (defaults to: :unset)

    The channel type. Can be: ‘web`, `facebook`, `sms`, `whatsapp`, `line` or `custom`.

  • contact_identity (String) (defaults to: :unset)

    The channel contact’s Identity.

  • enabled (Boolean) (defaults to: :unset)

    Whether the FlexFlow is enabled.

  • integration_type (flex_flow.IntegrationType) (defaults to: :unset)

    The integration type. Can be: ‘studio`, `external`, or `task`.

  • integration_flow_sid (String) (defaults to: :unset)

    The SID of the Flow when ‘integration_type` is `studio`.

  • integration_url (String) (defaults to: :unset)

    The External Webhook URL when ‘integration_type` is `external`.

  • integration_workspace_sid (String) (defaults to: :unset)

    The Workspace SID for a new task when ‘integration_type` is `task`.

  • integration_workflow_sid (String) (defaults to: :unset)

    The Workflow SID for a new task when ‘integration_type` is `task`.

  • integration_channel (String) (defaults to: :unset)

    The task channel for a new task when ‘integration_type` is `task`. The default is `default`.

  • integration_timeout (String) (defaults to: :unset)

    The task timeout in seconds for a new task when ‘integration_type` is `task`. The default is `86,400` seconds (24 hours).

  • integration_priority (String) (defaults to: :unset)

    The task priority of a new task when ‘integration_type` is `task`. The default priority is `0`.

  • integration_creation_on_message (Boolean) (defaults to: :unset)

    Whether to create a task when the first message arrives when ‘integration_type` is `task`. If `false`, the task is created with the channel. Note that does not apply when channel type is `web`. Setting the value to `true` for channel type `web` will result in misconfigured Flex Flow and no tasks will be created.

  • long_lived (Boolean) (defaults to: :unset)

    When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to ‘false`.

  • janitor_enabled (Boolean) (defaults to: :unset)

    When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to ‘false`.

  • integration_retry_count (String) (defaults to: :unset)

    The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0.

Returns:



501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 501

def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
  context.update(
      friendly_name: friendly_name,
      chat_service_sid: chat_service_sid,
      channel_type: channel_type,
      contact_identity: contact_identity,
      enabled: enabled,
      integration_type: integration_type,
      integration_flow_sid: integration_flow_sid,
      integration_url: integration_url,
      integration_workspace_sid: integration_workspace_sid,
      integration_workflow_sid: integration_workflow_sid,
      integration_channel: integration_channel,
      integration_timeout: integration_timeout,
      integration_priority: integration_priority,
      integration_creation_on_message: integration_creation_on_message,
      long_lived: long_lived,
      janitor_enabled: janitor_enabled,
      integration_retry_count: integration_retry_count,
  )
end

#urlString

Returns The absolute URL of the FlexFlow resource.

Returns:

  • (String)

    The absolute URL of the FlexFlow resource



450
451
452
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 450

def url
  @properties['url']
end