Class: Twilio::REST::FlexApi::V1::ChannelInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the ChannelInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 262

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'flex_flow_sid' => payload['flex_flow_sid'],
        'sid' => payload['sid'],
        'user_sid' => payload['user_sid'],
        'task_sid' => payload['task_sid'],
        'url' => payload['url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow.

Returns:



295
296
297
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 295

def 
    @properties['account_sid']
end

#contextChannelContext

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

Returns:



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

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

#date_createdTime

Returns The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



331
332
333
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 331

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



337
338
339
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 337

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ChannelInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



344
345
346
347
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 344

def delete

    context.delete
end

#fetchChannelInstance

Fetch the ChannelInstance

Returns:



352
353
354
355
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 352

def fetch

    context.fetch
end

#flex_flow_sidString

Returns The SID of the Flex Flow.

Returns:

  • (String)

    The SID of the Flex Flow.



301
302
303
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 301

def flex_flow_sid
    @properties['flex_flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



366
367
368
369
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 366

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

#sidString

Returns The unique string that we created to identify the Channel resource.

Returns:

  • (String)

    The unique string that we created to identify the Channel resource.



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

def sid
    @properties['sid']
end

#task_sidString

Returns The SID of the TaskRouter Task. Only valid when integration type is ‘task`. `null` for integration types `studio` & `external`.

Returns:

  • (String)

    The SID of the TaskRouter Task. Only valid when integration type is ‘task`. `null` for integration types `studio` & `external`



319
320
321
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 319

def task_sid
    @properties['task_sid']
end

#to_sObject

Provide a user friendly representation



359
360
361
362
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 359

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

#urlString

Returns The absolute URL of the Flex chat channel resource.

Returns:

  • (String)

    The absolute URL of the Flex chat channel resource.



325
326
327
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 325

def url
    @properties['url']
end

#user_sidString

Returns The SID of the chat user.

Returns:

  • (String)

    The SID of the chat user.



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

def user_sid
    @properties['user_sid']
end