Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::MessageContext::DeliveryReceiptInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, message_sid: nil, sid: nil) ⇒ DeliveryReceiptInstance

Initialize the DeliveryReceiptInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this DeliveryReceipt resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 396

def initialize(version, payload , chat_service_sid: nil, conversation_sid: nil, message_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'chat_service_sid' => payload['chat_service_sid'],
        'conversation_sid' => payload['conversation_sid'],
        'message_sid' => payload['message_sid'],
        'sid' => payload['sid'],
        'channel_message_sid' => payload['channel_message_sid'],
        'participant_sid' => payload['participant_sid'],
        'status' => payload['status'],
        'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
        '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 = { 'chat_service_sid' => chat_service_sid  || @properties['chat_service_sid']  ,'conversation_sid' => conversation_sid  || @properties['conversation_sid']  ,'message_sid' => message_sid  || @properties['message_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this participant.

Returns:



434
435
436
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 434

def 
    @properties['account_sid']
end

#channel_message_sidString

Returns A messaging channel-specific identifier for the message delivered to participant e.g. ‘SMxx` for SMS, `WAxx` for Whatsapp etc.

Returns:

  • (String)

    A messaging channel-specific identifier for the message delivered to participant e.g. ‘SMxx` for SMS, `WAxx` for Whatsapp etc.



464
465
466
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 464

def channel_message_sid
    @properties['channel_message_sid']
end

#chat_service_sidString

Returns The SID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with.

Returns:



440
441
442
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 440

def chat_service_sid
    @properties['chat_service_sid']
end

#contextDeliveryReceiptContext

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

Returns:



425
426
427
428
429
430
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 425

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

#conversation_sidString

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

Returns:



446
447
448
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 446

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.



488
489
490
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 488

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated. ‘null` if the delivery receipt has not been updated.

Returns:

  • (Time)

    The date that this resource was last updated. ‘null` if the delivery receipt has not been updated.



494
495
496
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 494

def date_updated
    @properties['date_updated']
end

#error_codeString

Returns The message [delivery error code](www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a ‘failed` status,.

Returns:



482
483
484
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 482

def error_code
    @properties['error_code']
end

#fetchDeliveryReceiptInstance

Fetch the DeliveryReceiptInstance

Returns:



507
508
509
510
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 507

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



521
522
523
524
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 521

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

#message_sidString

Returns The SID of the message within a [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to.

Returns:



452
453
454
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 452

def message_sid
    @properties['message_sid']
end

#participant_sidString

Returns The unique ID of the participant the delivery receipt belongs to.

Returns:

  • (String)

    The unique ID of the participant the delivery receipt belongs to.



470
471
472
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 470

def participant_sid
    @properties['participant_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



458
459
460
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 458

def sid
    @properties['sid']
end

#statusDeliveryStatus

Returns:

  • (DeliveryStatus)


476
477
478
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 476

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



514
515
516
517
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 514

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

#urlString

Returns An absolute API resource URL for this delivery receipt.

Returns:

  • (String)

    An absolute API resource URL for this delivery receipt.



500
501
502
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message/delivery_receipt.rb', line 500

def url
    @properties['url']
end