Class: Twilio::REST::FlexApi::V1::FlexFlowContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ FlexFlowContext

Initialize the FlexFlowContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the FlexFlow resource to fetch.



221
222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 221

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {sid: sid, }
  @uri = "/FlexFlows/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the FlexFlowInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
   @version.delete('DELETE', @uri)
end

#fetchFlexFlowInstance

Fetch the FlexFlowInstance

Returns:



232
233
234
235
236
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 232

def fetch
  payload = @version.fetch('GET', @uri)

  FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



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

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
end

#to_sObject

Provide a user friendly representation



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

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.FlexFlowContext #{context}>"
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:



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb', line 278

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)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'ChatServiceSid' => chat_service_sid,
      'ChannelType' => channel_type,
      'ContactIdentity' => contact_identity,
      'Enabled' => enabled,
      'IntegrationType' => integration_type,
      'Integration.FlowSid' => integration_flow_sid,
      'Integration.Url' => integration_url,
      'Integration.WorkspaceSid' => integration_workspace_sid,
      'Integration.WorkflowSid' => integration_workflow_sid,
      'Integration.Channel' => integration_channel,
      'Integration.Timeout' => integration_timeout,
      'Integration.Priority' => integration_priority,
      'Integration.CreationOnMessage' => integration_creation_on_message,
      'LongLived' => long_lived,
      'JanitorEnabled' => janitor_enabled,
      'Integration.RetryCount' => integration_retry_count,
  })

  payload = @version.update('POST', @uri, data: data)

  FlexFlowInstance.new(@version, payload, sid: @solution[:sid], )
end