Class: Twilio::REST::FlexApi::V1::WebChannelInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the WebChannelInstance

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



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 252

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'],
      '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



283
284
285
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 283

def 
  @properties['account_sid']
end

#contextWebChannelContext

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

Returns:



274
275
276
277
278
279
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 274

def context
  unless @instance_context
    @instance_context = WebChannelContext.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.



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

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.



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the WebChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#fetchWebChannelInstance

Fetch a WebChannelInstance

Returns:



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

def fetch
  context.fetch
end

#flex_flow_sidString

Returns The unique ID of the FlexFlow.

Returns:

  • (String)

    The unique ID of the FlexFlow



289
290
291
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 289

def flex_flow_sid
  @properties['flex_flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



350
351
352
353
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 350

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

#sidString

Returns Flex Chat Channel Sid.

Returns:

  • (String)

    Flex Chat Channel Sid



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



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

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

#update(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance

Update the WebChannelInstance

Parameters:

  • chat_status (web_channel.ChatStatus) (defaults to: :unset)

    Chat status, can only used to make chat ‘inactive’

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

    Post-engagement data

Returns:



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

def update(chat_status: :unset, post_engagement_data: :unset)
  context.update(chat_status: chat_status, post_engagement_data: post_engagement_data, )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end