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

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

Instance Method Summary collapse

Constructor Details

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

Initialize the ParticipantInstance



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 339

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'],
        'role_sid' => payload['role_sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i,
        'last_read_timestamp' => payload['last_read_timestamp'],
    }

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

Instance Method Details

#account_sidString



376
377
378
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 376

def 
    @properties['account_sid']
end

#attributesString



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

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



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

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

#conversation_sidString



382
383
384
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 382

def conversation_sid
    @properties['conversation_sid']
end

#date_createdTime



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

def date_created
    @properties['date_created']
end

#date_updatedTime



424
425
426
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 424

def date_updated
    @properties['date_updated']
end

#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean

Delete the ParticipantInstance



450
451
452
453
454
455
456
457
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 450

def delete(
    x_twilio_webhook_enabled: :unset
)

    context.delete(
        x_twilio_webhook_enabled: x_twilio_webhook_enabled, 
    )
end

#fetchParticipantInstance

Fetch the ParticipantInstance



462
463
464
465
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 462

def fetch

    context.fetch
end

#identityString



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

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



516
517
518
519
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 516

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

#last_read_message_indexString



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

def last_read_message_index
    @properties['last_read_message_index']
end

#last_read_timestampString



442
443
444
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 442

def last_read_timestamp
    @properties['last_read_timestamp']
end

#messaging_bindingHash



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

def messaging_binding
    @properties['messaging_binding']
end

#role_sidString



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

def role_sid
    @properties['role_sid']
end

#sidString



388
389
390
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 388

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



509
510
511
512
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 509

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, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 480

def update(
    date_created: :unset, 
    date_updated: :unset, 
    attributes: :unset, 
    role_sid: :unset, 
    messaging_binding_proxy_address: :unset, 
    messaging_binding_projected_address: :unset, 
    identity: :unset, 
    last_read_message_index: :unset, 
    last_read_timestamp: :unset, 
    x_twilio_webhook_enabled: :unset
)

    context.update(
        date_created: date_created, 
        date_updated: date_updated, 
        attributes: attributes, 
        role_sid: role_sid, 
        messaging_binding_proxy_address: messaging_binding_proxy_address, 
        messaging_binding_projected_address: messaging_binding_projected_address, 
        identity: identity, 
        last_read_message_index: last_read_message_index, 
        last_read_timestamp: last_read_timestamp, 
        x_twilio_webhook_enabled: x_twilio_webhook_enabled, 
    )
end

#urlString



430
431
432
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb', line 430

def url
    @properties['url']
end