class Twilio::REST::Api::V2010::AccountContext::MessageInstance
Public Class Methods
Initialize the MessageInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] account_sid
The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that sent the message that created the resource.
@param [String] sid The Twilio-provided string that uniquely identifies the
Message resource to fetch.
@return [MessageInstance] MessageInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 401 def initialize(version, payload, account_sid: nil, sid: nil) 402 super(version) 403 404 # Marshaled Properties 405 @properties = { 406 'body' => payload['body'], 407 'num_segments' => payload['num_segments'], 408 'direction' => payload['direction'], 409 'from' => payload['from'], 410 'to' => payload['to'], 411 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 412 'price' => payload['price'], 413 'error_message' => payload['error_message'], 414 'uri' => payload['uri'], 415 'account_sid' => payload['account_sid'], 416 'num_media' => payload['num_media'], 417 'status' => payload['status'], 418 'messaging_service_sid' => payload['messaging_service_sid'], 419 'sid' => payload['sid'], 420 'date_sent' => Twilio.deserialize_rfc2822(payload['date_sent']), 421 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 422 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i, 423 'price_unit' => payload['price_unit'], 424 'api_version' => payload['api_version'], 425 'subresource_uris' => payload['subresource_uris'], 426 } 427 428 # Context 429 @instance_context = nil 430 @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } 431 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 500 def account_sid 501 @properties['account_sid'] 502 end
@return [String] The API version used to process the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 554 def api_version 555 @properties['api_version'] 556 end
@return [String] The message text
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 446 def body 447 @properties['body'] 448 end
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/api/v2010/account/message.rb 437 def context 438 unless @instance_context 439 @instance_context = MessageContext.new(@version, @params['account_sid'], @params['sid'], ) 440 end 441 @instance_context 442 end
@return [Time] The RFC 2822 date and time in GMT that the resource was created
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 536 def date_created 537 @properties['date_created'] 538 end
@return [Time] The RFC 2822 date and time in GMT when the message was sent
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 530 def date_sent 531 @properties['date_sent'] 532 end
@return [Time] The RFC 2822 date and time in GMT that the resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 476 def date_updated 477 @properties['date_updated'] 478 end
Delete the MessageInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 567 def delete 568 context.delete 569 end
@return [message.Direction] The direction of the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 458 def direction 459 @properties['direction'] 460 end
@return [String] The error code associated with the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 542 def error_code 543 @properties['error_code'] 544 end
@return [String] The description of the error_code
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 488 def error_message 489 @properties['error_message'] 490 end
Access the feedback @return [feedback] feedback
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 597 def feedback 598 context.feedback 599 end
Fetch the MessageInstance
@return [MessageInstance] Fetched MessageInstance
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 574 def fetch 575 context.fetch 576 end
@return [String] The phone number that initiated the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 464 def from 465 @properties['from'] 466 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 610 def inspect 611 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 612 "<Twilio.Api.V2010.MessageInstance #{values}>" 613 end
Access the media @return [media] media
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 590 def media 591 context.media 592 end
@return [String] The SID of the Messaging
Service used with the message.
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 518 def messaging_service_sid 519 @properties['messaging_service_sid'] 520 end
@return [String] The number of media files associated with the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 506 def num_media 507 @properties['num_media'] 508 end
@return [String] The number of messages used to deliver the message body
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 452 def num_segments 453 @properties['num_segments'] 454 end
@return [String] The amount billed for the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 482 def price 483 @properties['price'] 484 end
@return [String] The currency in which price is measured
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 548 def price_unit 549 @properties['price_unit'] 550 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 524 def sid 525 @properties['sid'] 526 end
@return [message.Status] The status of the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 512 def status 513 @properties['status'] 514 end
@return [String] A list of related resources identified by their relative URIs
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 560 def subresource_uris 561 @properties['subresource_uris'] 562 end
@return [String] The phone number that received the message
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 470 def to 471 @properties['to'] 472 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 603 def to_s 604 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 605 "<Twilio.Api.V2010.MessageInstance #{values}>" 606 end
Update the MessageInstance
@param [String] body The text of the message you want to send. Can be up to
1,600 characters long.
@return [MessageInstance] Updated MessageInstance
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 583 def update(body: :unset) 584 context.update(body: body, ) 585 end
@return [String] The URI of the resource, relative to `api.twilio.com`
# File lib/twilio-ruby/rest/api/v2010/account/message.rb 494 def uri 495 @properties['uri'] 496 end