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 SID of the Flex chat channel resource to fetch.


230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 230

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 that created the resource and owns this Workflow.

Returns:

  • (String)

    The SID of the Account that created the resource and owns this Workflow


263
264
265
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 263

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:


254
255
256
257
258
259
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 254

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the Flex chat channel was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the Flex chat channel was created


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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the Flex chat channel was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the Flex chat channel was last updated


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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
  context.delete
end

#fetchChannelInstance

Fetch the ChannelInstance

Returns:


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

def fetch
  context.fetch
end

#flex_flow_sidString

Returns The SID of the Flex Flow.

Returns:

  • (String)

    The SID of the Flex Flow


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

def flex_flow_sid
  @properties['flex_flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation


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

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

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#task_sidString

Returns The SID of the TaskRouter Task.

Returns:

  • (String)

    The SID of the TaskRouter Task


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

def task_sid
  @properties['task_sid']
end

#to_sObject

Provide a user friendly representation


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

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


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

def url
  @properties['url']
end

#user_sidString

Returns The SID of the chat user.

Returns:

  • (String)

    The SID of the chat user


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

def user_sid
  @properties['user_sid']
end