Class: Twilio::REST::Messaging::V1::SessionContext::ParticipantInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/session/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, session_sid: nil, sid: nil) ⇒ ParticipantInstance

Initialize the ParticipantInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • session_sid (String) (defaults to: nil)

    The unique id of the [Session](www.twilio.com/docs/sessions/api/session) for this participant.

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 304

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'messaging_service_sid' => payload['messaging_service_sid'],
      'session_sid' => payload['session_sid'],
      'sid' => payload['sid'],
      'identity' => payload['identity'],
      'twilio_address' => payload['twilio_address'],
      'user_address' => payload['user_address'],
      'attributes' => payload['attributes'],
      'type' => payload['type'],
      '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 = {'session_sid' => session_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

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

Returns:

  • (String)

    The unique id of the Account responsible for this session.



342
343
344
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 342

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.



390
391
392
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 390

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:



333
334
335
336
337
338
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 333

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

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



402
403
404
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 402

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.



408
409
410
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 408

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ParticipantInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



443
444
445
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 443

def delete
  context.delete
end

#fetchParticipantInstance

Fetch a ParticipantInstance

Returns:



436
437
438
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 436

def fetch
  context.fetch
end

#identityString

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

Returns:

  • (String)

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



372
373
374
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 372

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



456
457
458
459
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 456

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

#messaging_service_sidString

Returns The unique id of the SMS Service this session belongs to.

Returns:

  • (String)

    The unique id of the SMS Service this session belongs to.



354
355
356
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 354

def messaging_service_sid
  @properties['messaging_service_sid']
end

#service_sidString

Returns The unique id of the Chat Service this session belongs to.

Returns:

  • (String)

    The unique id of the Chat Service this session belongs to.



348
349
350
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 348

def service_sid
  @properties['service_sid']
end

#session_sidString

Returns The unique id of the Session for this participant.

Returns:

  • (String)

    The unique id of the Session for this participant.



360
361
362
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 360

def session_sid
  @properties['session_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



366
367
368
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 366

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



449
450
451
452
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 449

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

#twilio_addressString

Returns The address of the Twilio phone number that the participant is in contact with.

Returns:

  • (String)

    The address of the Twilio phone number that the participant is in contact with.



378
379
380
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 378

def twilio_address
  @properties['twilio_address']
end

#typeparticipant.ParticipantType

Returns The type of twilio product, participant is a user of.

Returns:

  • (participant.ParticipantType)

    The type of twilio product, participant is a user of.



396
397
398
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 396

def type
  @properties['type']
end

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

Update the ParticipantInstance

Parameters:

  • 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.

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

    The date that this resource was created. This is useful when bulk-importing messages from another system, as the provided value will be trusted and displayed on SDK clients.

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

    The date that this resource was last updated.

Returns:



429
430
431
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 429

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

#urlString

Returns An absolute URL for this participant.

Returns:

  • (String)

    An absolute URL for this participant.



414
415
416
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 414

def url
  @properties['url']
end

#user_addressString

Returns The address of the participant’s device.

Returns:

  • (String)

    The address of the participant’s device.



384
385
386
# File 'lib/twilio-ruby/rest/messaging/v1/session/participant.rb', line 384

def user_address
  @properties['user_address']
end