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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, 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

  • conversation_sid (String) (defaults to: nil)

    The unique ID of the Conversation for this message.

  • message_sid (String) (defaults to: nil)

    The SID of the message within a Conversation the delivery receipt belongs to

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 220

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'conversation_sid' => payload['conversation_sid'],
      'sid' => payload['sid'],
      'message_sid' => payload['message_sid'],
      'channel_message_sid' => payload['channel_message_sid'],
      'participant_sid' => payload['participant_sid'],
      'status' => payload['status'],
      '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 = {
      'conversation_sid' => conversation_sid,
      'message_sid' => message_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.


265
266
267
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 265

def 
  @properties['account_sid']
end

#channel_message_sidString

Returns A messaging channel-specific identifier for the message delivered to participant.

Returns:

  • (String)

    A messaging channel-specific identifier for the message delivered to participant


289
290
291
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 289

def channel_message_sid
  @properties['channel_message_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:


251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 251

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

#conversation_sidString

Returns The unique ID of the Conversation for this message.

Returns:

  • (String)

    The unique ID of the Conversation for this message.


271
272
273
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 271

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.


313
314
315
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 313

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.


319
320
321
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 319

def date_updated
  @properties['date_updated']
end

#error_codeString

Returns The message delivery error code for a `failed` status.

Returns:


307
308
309
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 307

def error_code
  @properties['error_code']
end

#fetchDeliveryReceiptInstance

Fetch the DeliveryReceiptInstance

Returns:


332
333
334
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 332

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


345
346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 345

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

#message_sidString

Returns The SID of the message the delivery receipt belongs to.

Returns:

  • (String)

    The SID of the message the delivery receipt belongs to


283
284
285
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 283

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.


295
296
297
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 295

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.


277
278
279
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 277

def sid
  @properties['sid']
end

#statusdelivery_receipt.DeliveryStatus

Returns The message delivery status.

Returns:

  • (delivery_receipt.DeliveryStatus)

    The message delivery status


301
302
303
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 301

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation


338
339
340
341
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 338

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

#urlString

Returns An absolute URL for this delivery receipt.

Returns:

  • (String)

    An absolute URL for this delivery receipt.


325
326
327
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb', line 325

def url
  @properties['url']
end