class Twilio::REST::Conversations::V1::ConversationContext::MessageInstance

Public Class Methods

new(version, payload, conversation_sid: nil, sid: nil) click to toggle source

Initialize the MessageInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] conversation_sid The unique ID of the

{Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
for this message.

@param [String] sid A 34 character string that uniquely identifies this

resource.

@return [MessageInstance] MessageInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
314 def initialize(version, payload, conversation_sid: nil, sid: nil)
315   super(version)
316 
317   # Marshaled Properties
318   @properties = {
319       'account_sid' => payload['account_sid'],
320       'conversation_sid' => payload['conversation_sid'],
321       'sid' => payload['sid'],
322       'index' => payload['index'].to_i,
323       'author' => payload['author'],
324       'body' => payload['body'],
325       'media' => payload['media'],
326       'attributes' => payload['attributes'],
327       'participant_sid' => payload['participant_sid'],
328       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
329       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
330       'url' => payload['url'],
331       'delivery' => payload['delivery'],
332       'links' => payload['links'],
333   }
334 
335   # Context
336   @instance_context = nil
337   @params = {'conversation_sid' => conversation_sid, 'sid' => sid || @properties['sid'], }
338 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The unique ID of the Account responsible for this message.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
353 def account_sid
354   @properties['account_sid']
355 end
attributes() click to toggle source

@return [String] A string metadata field you can use to store any data you wish.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
395 def attributes
396   @properties['attributes']
397 end
author() click to toggle source

@return [String] The channel specific identifier of the message's author.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
377 def author
378   @properties['author']
379 end
body() click to toggle source

@return [String] The content of the message.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
383 def body
384   @properties['body']
385 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [MessageContext] MessageContext for this MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
344 def context
345   unless @instance_context
346     @instance_context = MessageContext.new(@version, @params['conversation_sid'], @params['sid'], )
347   end
348   @instance_context
349 end
conversation_sid() click to toggle source

@return [String] The unique ID of the Conversation for this message.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
359 def conversation_sid
360   @properties['conversation_sid']
361 end
date_created() click to toggle source

@return [Time] The date that this resource was created.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
407 def date_created
408   @properties['date_created']
409 end
date_updated() click to toggle source

@return [Time] The date that this resource was last updated.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
413 def date_updated
414   @properties['date_updated']
415 end
delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the MessageInstance @param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
466 def delete(x_twilio_webhook_enabled: :unset)
467   context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
468 end
delivery() click to toggle source

@return [Hash] An object that contains the summary of delivery statuses for the message to non-chat participants.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
425 def delivery
426   @properties['delivery']
427 end
delivery_receipts() click to toggle source

Access the delivery_receipts @return [delivery_receipts] delivery_receipts

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
480 def delivery_receipts
481   context.delivery_receipts
482 end
fetch() click to toggle source

Fetch the MessageInstance @return [MessageInstance] Fetched MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
473 def fetch
474   context.fetch
475 end
index() click to toggle source

@return [String] The index of the message within the Conversation.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
371 def index
372   @properties['index']
373 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
493 def inspect
494   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
495   "<Twilio.Conversations.V1.MessageInstance #{values}>"
496 end
media() click to toggle source

@return [Array] An array of objects that describe the Message's media if attached, otherwise, null.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
389 def media
390   @properties['media']
391 end
participant_sid() click to toggle source

@return [String] The unique ID of messages's author participant.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
401 def participant_sid
402   @properties['participant_sid']
403 end
sid() click to toggle source

@return [String] A 34 character string that uniquely identifies this resource.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
365 def sid
366   @properties['sid']
367 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
486 def to_s
487   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
488   "<Twilio.Conversations.V1.MessageInstance #{values}>"
489 end
update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the MessageInstance @param [String] author The channel specific identifier of the message's author.

Defaults to `system`.

@param [String] body The content of the message, can be up to 1,600 characters

long.

@param [Time] date_created The date that this resource was created. @param [Time] date_updated The date that this resource was last updated. `null`

if the message has not been edited.

@param [String] attributes A 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.

@param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [MessageInstance] Updated MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
450 def update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset)
451   context.update(
452       author: author,
453       body: body,
454       date_created: date_created,
455       date_updated: date_updated,
456       attributes: attributes,
457       x_twilio_webhook_enabled: x_twilio_webhook_enabled,
458   )
459 end
url() click to toggle source

@return [String] An absolute API URL for this message.

    # File lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
419 def url
420   @properties['url']
421 end