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

  • sid (String) (defaults to: nil)

    The unique SID identifier of the Flex Chat Channel



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 242

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 ID of the account that owns this Workflow.

Returns:

  • (String)

    The ID of the account that owns this Workflow



275
276
277
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 275

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:



266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 266

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

#date_createdTime

Returns The time the Flex Chat Channel was created, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The time the Flex Chat Channel was created, given as GMT in ISO 8601 format.



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The time the Flex Chat Channel was last updated, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The time the Flex Chat Channel was last updated, given as GMT in ISO 8601 format.



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#fetchChannelInstance

Fetch a ChannelInstance

Returns:



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

def fetch
  context.fetch
end

#flex_flow_sidString

Returns The unique ID of the FlexFlow.

Returns:

  • (String)

    The unique ID of the FlexFlow



281
282
283
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 281

def flex_flow_sid
  @properties['flex_flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#sidString

Returns Flex Chat Channel Sid.

Returns:

  • (String)

    Flex Chat Channel Sid



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

def sid
  @properties['sid']
end

#task_sidString

Returns TaskRouter Task Sid.

Returns:

  • (String)

    TaskRouter Task Sid.



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

def task_sid
  @properties['task_sid']
end

#to_sObject

Provide a user friendly representation



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

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end

#user_sidString

Returns Chat User Sid.

Returns:

  • (String)

    Chat User Sid.



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

def user_sid
  @properties['user_sid']
end