Class: Twilio::REST::Api::V2010::AccountContext::MessageInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Api::V2010::AccountContext::MessageInstance
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/message.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the resource.
-
#api_version ⇒ String
The API version used to process the message.
-
#body ⇒ String
The message text.
-
#context ⇒ MessageContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The RFC 2822 date and time in GMT that the resource was created.
-
#date_sent ⇒ Time
The RFC 2822 date and time in GMT when the message was sent.
-
#date_updated ⇒ Time
The RFC 2822 date and time in GMT that the resource was last updated.
-
#delete ⇒ Boolean
Delete the MessageInstance.
-
#direction ⇒ message.Direction
The direction of the message.
-
#error_code ⇒ String
The error code associated with the message.
-
#error_message ⇒ String
The description of the error_code.
-
#feedback ⇒ feedback
Access the feedback.
-
#fetch ⇒ MessageInstance
Fetch the MessageInstance.
-
#from ⇒ String
The phone number that initiated the message.
-
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ MessageInstance
constructor
Initialize the MessageInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#media ⇒ media
Access the media.
-
#messaging_service_sid ⇒ String
The SID of the Messaging Service used with the message.
-
#num_media ⇒ String
The number of media files associated with the message.
-
#num_segments ⇒ String
The number of messages used to deliver the message body.
-
#price ⇒ String
The amount billed for the message.
-
#price_unit ⇒ String
The currency in which price is measured.
-
#sid ⇒ String
The unique string that identifies the resource.
-
#status ⇒ message.Status
The status of the message.
-
#subresource_uris ⇒ String
A list of related resources identified by their relative URIs.
-
#to ⇒ String
The phone number that received the message.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance.
-
#uri ⇒ String
The URI of the resource, relative to ‘api.twilio.com`.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ MessageInstance
Initialize the MessageInstance
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 428 def initialize(version, payload, account_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'body' => payload['body'], 'num_segments' => payload['num_segments'], 'direction' => payload['direction'], 'from' => payload['from'], 'to' => payload['to'], 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'price' => payload['price'], 'error_message' => payload['error_message'], 'uri' => payload['uri'], 'account_sid' => payload['account_sid'], 'num_media' => payload['num_media'], 'status' => payload['status'], 'messaging_service_sid' => payload['messaging_service_sid'], 'sid' => payload['sid'], 'date_sent' => Twilio.deserialize_rfc2822(payload['date_sent']), 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i, 'price_unit' => payload['price_unit'], 'api_version' => payload['api_version'], 'subresource_uris' => payload['subresource_uris'], } # Context @instance_context = nil @params = {'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
527 528 529 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 527 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
Returns The API version used to process the message.
581 582 583 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 581 def api_version @properties['api_version'] end |
#body ⇒ String
Returns The message text.
473 474 475 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 473 def body @properties['body'] end |
#context ⇒ MessageContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
464 465 466 467 468 469 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 464 def context unless @instance_context @instance_context = MessageContext.new(@version, @params['account_sid'], @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The RFC 2822 date and time in GMT that the resource was created.
563 564 565 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 563 def date_created @properties['date_created'] end |
#date_sent ⇒ Time
Returns The RFC 2822 date and time in GMT when the message was sent.
557 558 559 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 557 def date_sent @properties['date_sent'] end |
#date_updated ⇒ Time
Returns The RFC 2822 date and time in GMT that the resource was last updated.
503 504 505 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 503 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the MessageInstance
594 595 596 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 594 def delete context.delete end |
#direction ⇒ message.Direction
Returns The direction of the message.
485 486 487 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 485 def direction @properties['direction'] end |
#error_code ⇒ String
Returns The error code associated with the message.
569 570 571 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 569 def error_code @properties['error_code'] end |
#error_message ⇒ String
Returns The description of the error_code.
515 516 517 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 515 def @properties['error_message'] end |
#feedback ⇒ feedback
Access the feedback
626 627 628 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 626 def feedback context.feedback end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
601 602 603 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 601 def fetch context.fetch end |
#from ⇒ String
Returns The phone number that initiated the message.
491 492 493 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 491 def from @properties['from'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
639 640 641 642 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 639 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.MessageInstance #{values}>" end |
#media ⇒ media
Access the media
619 620 621 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 619 def media context.media end |
#messaging_service_sid ⇒ String
Returns The SID of the Messaging Service used with the message.
545 546 547 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 545 def messaging_service_sid @properties['messaging_service_sid'] end |
#num_media ⇒ String
Returns The number of media files associated with the message.
533 534 535 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 533 def num_media @properties['num_media'] end |
#num_segments ⇒ String
Returns The number of messages used to deliver the message body.
479 480 481 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 479 def num_segments @properties['num_segments'] end |
#price ⇒ String
Returns The amount billed for the message.
509 510 511 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 509 def price @properties['price'] end |
#price_unit ⇒ String
Returns The currency in which price is measured.
575 576 577 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 575 def price_unit @properties['price_unit'] end |
#sid ⇒ String
Returns The unique string that identifies the resource.
551 552 553 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 551 def sid @properties['sid'] end |
#status ⇒ message.Status
Returns The status of the message.
539 540 541 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 539 def status @properties['status'] end |
#subresource_uris ⇒ String
Returns A list of related resources identified by their relative URIs.
587 588 589 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 587 def subresource_uris @properties['subresource_uris'] end |
#to ⇒ String
Returns The phone number that received the message.
497 498 499 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 497 def to @properties['to'] end |
#to_s ⇒ Object
Provide a user friendly representation
632 633 634 635 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 632 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.MessageInstance #{values}>" end |
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance
612 613 614 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 612 def update(body: :unset, status: :unset) context.update(body: body, status: status, ) end |
#uri ⇒ String
Returns The URI of the resource, relative to ‘api.twilio.com`.
521 522 523 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 521 def uri @properties['uri'] end |