Class: Twilio::REST::Conversations::V1::ConversationContext::ParticipantInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, conversation_sid: nil, sid: nil) ⇒ ParticipantInstance

Initialize the ParticipantInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • conversation_sid (String) (defaults to: nil)

    The unique id of the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for this participant.

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 297

def initialize(version, payload, conversation_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'conversation_sid' => payload['conversation_sid'],
      'sid' => payload['sid'],
      'identity' => payload['identity'],
      'attributes' => payload['attributes'],
      'messaging_binding' => payload['messaging_binding'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
  }

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

Instance Method Details

#account_sidString

Returns The unique id of the Account responsible for this participant.

Returns:

  • (String)

    The unique id of the Account responsible for this participant.



331
332
333
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 331

def 
  @properties['account_sid']
end

#attributesString

Returns An optional string metadata field you can use to store any data you wish.

Returns:

  • (String)

    An optional string metadata field you can use to store any data you wish.



355
356
357
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 355

def attributes
  @properties['attributes']
end

#contextParticipantContext

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

Returns:



322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 322

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

#conversation_sidString

Returns The unique id of the Conversation for this participant.

Returns:

  • (String)

    The unique id of the Conversation for this participant.



337
338
339
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 337

def conversation_sid
  @properties['conversation_sid']
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



367
368
369
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 367

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • (Time)

    The date that this resource was last updated.



373
374
375
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 373

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ParticipantInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



399
400
401
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 399

def delete
  context.delete
end

#fetchParticipantInstance

Fetch a ParticipantInstance

Returns:



406
407
408
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 406

def fetch
  context.fetch
end

#identityString

Returns A unique string identifier for the conversation participant as Chat User.

Returns:

  • (String)

    A unique string identifier for the conversation participant as Chat User.



349
350
351
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 349

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



419
420
421
422
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 419

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

#messaging_bindingHash

Returns Information about how this participant exchanges messages with the conversation.

Returns:

  • (Hash)

    Information about how this participant exchanges messages with the conversation.



361
362
363
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 361

def messaging_binding
  @properties['messaging_binding']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



343
344
345
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 343

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



412
413
414
415
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 412

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

#update(date_created: :unset, date_updated: :unset, attributes: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

  • date_created (Time) (defaults to: :unset)

    The date that this resource was created.

  • date_updated (Time) (defaults to: :unset)

    The date that this resource was last updated.

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

    An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set “{}” will be returned.

Returns:



392
393
394
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 392

def update(date_created: :unset, date_updated: :unset, attributes: :unset)
  context.update(date_created: date_created, date_updated: date_updated, attributes: attributes, )
end

#urlString

Returns An absolute URL for this participant.

Returns:

  • (String)

    An absolute URL for this participant.



379
380
381
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 379

def url
  @properties['url']
end