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 unique sid that identifies this account.
-
#api_version ⇒ String
The version of the Twilio API used to process the message.
-
#body ⇒ String
The text body of the message.
-
#context ⇒ MessageContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date this resource was created.
-
#date_sent ⇒ Time
The date the message was sent.
-
#date_updated ⇒ Time
The date this resource was last updated.
-
#delete ⇒ Boolean
Deletes the MessageInstance.
-
#direction ⇒ message.Direction
The direction of the message.
-
#error_code ⇒ String
The error code associated with the message.
-
#error_message ⇒ String
Human readable description of the ErrorCode.
-
#feedback ⇒ feedback
Access the feedback.
-
#fetch ⇒ MessageInstance
Fetch a 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 messaging_service_sid.
-
#num_media ⇒ String
Number of media files associated with the message.
-
#num_segments ⇒ String
Indicates number of messages used to delivery the body.
-
#price ⇒ String
The amount billed for the message.
-
#price_unit ⇒ String
The currency in which Price is measured.
-
#sid ⇒ String
A string that uniquely identifies this message.
-
#status ⇒ message.Status
The status of this message.
-
#subresource_uris ⇒ String
The URI for any subresources.
-
#to ⇒ String
The phone number that received the message.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(body: nil) ⇒ MessageInstance
Update the MessageInstance.
-
#uri ⇒ String
The URI for this resource.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ MessageInstance
Initialize the MessageInstance
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 374 def initialize(version, payload, account_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'api_version' => payload['api_version'], 'body' => payload['body'], 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'date_sent' => Twilio.deserialize_rfc2822(payload['date_sent']), 'direction' => payload['direction'], 'error_code' => payload['error_code'].to_i, 'error_message' => payload['error_message'], 'from' => payload['from'], 'messaging_service_sid' => payload['messaging_service_sid'], 'num_media' => payload['num_media'], 'num_segments' => payload['num_segments'], 'price' => payload['price'].to_f, 'price_unit' => payload['price_unit'], 'sid' => payload['sid'], 'status' => payload['status'], 'subresource_uris' => payload['subresource_uris'], 'to' => payload['to'], 'uri' => payload['uri'], } # Context @instance_context = nil @params = { 'account_sid' => account_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique sid that identifies this account.
426 427 428 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 426 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
Returns The version of the Twilio API used to process the message.
432 433 434 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 432 def api_version @properties['api_version'] end |
#body ⇒ String
Returns The text body of the message. Up to 1600 characters long.
438 439 440 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 438 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
413 414 415 416 417 418 419 420 421 422 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 413 def context unless @instance_context @instance_context = MessageContext.new( @version, @params['account_sid'], @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The date this resource was created.
444 445 446 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 444 def date_created @properties['date_created'] end |
#date_sent ⇒ Time
Returns The date the message was sent.
456 457 458 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 456 def date_sent @properties['date_sent'] end |
#date_updated ⇒ Time
Returns The date this resource was last updated.
450 451 452 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 450 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the MessageInstance
547 548 549 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 547 def delete context.delete end |
#direction ⇒ message.Direction
Returns The direction of the message.
462 463 464 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 462 def direction @properties['direction'] end |
#error_code ⇒ String
Returns The error code associated with the message.
468 469 470 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 468 def error_code @properties['error_code'] end |
#error_message ⇒ String
Returns Human readable description of the ErrorCode.
474 475 476 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 474 def @properties['error_message'] end |
#feedback ⇒ feedback
Access the feedback
578 579 580 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 578 def feedback context.feedback end |
#fetch ⇒ MessageInstance
Fetch a MessageInstance
554 555 556 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 554 def fetch context.fetch end |
#from ⇒ String
Returns The phone number that initiated the message.
480 481 482 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 480 def from @properties['from'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
591 592 593 594 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 591 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.MessageInstance #{values}>" end |
#media ⇒ media
Access the media
571 572 573 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 571 def media context.media end |
#messaging_service_sid ⇒ String
Returns The messaging_service_sid.
486 487 488 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 486 def messaging_service_sid @properties['messaging_service_sid'] end |
#num_media ⇒ String
Returns Number of media files associated with the message.
492 493 494 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 492 def num_media @properties['num_media'] end |
#num_segments ⇒ String
Returns Indicates number of messages used to delivery the body.
498 499 500 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 498 def num_segments @properties['num_segments'] end |
#price ⇒ String
Returns The amount billed for the message.
504 505 506 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 504 def price @properties['price'] end |
#price_unit ⇒ String
Returns The currency in which Price is measured.
510 511 512 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 510 def price_unit @properties['price_unit'] end |
#sid ⇒ String
Returns A string that uniquely identifies this message.
516 517 518 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 516 def sid @properties['sid'] end |
#status ⇒ message.Status
Returns The status of this message.
522 523 524 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 522 def status @properties['status'] end |
#subresource_uris ⇒ String
Returns The URI for any subresources.
528 529 530 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 528 def subresource_uris @properties['subresource_uris'] end |
#to ⇒ String
Returns The phone number that received the message.
534 535 536 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 534 def to @properties['to'] end |
#to_s ⇒ Object
Provide a user friendly representation
584 585 586 587 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 584 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.MessageInstance #{values}>" end |
#update(body: nil) ⇒ MessageInstance
Update the MessageInstance
562 563 564 565 566 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 562 def update(body: nil) context.update( body: body, ) end |
#uri ⇒ String
Returns The URI for this resource.
540 541 542 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 540 def uri @properties['uri'] end |