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 associated with the Message resource.
-
#api_version ⇒ String
The API version used to process the Message.
-
#body ⇒ String
The text content of the message.
-
#context ⇒ MessageContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The RFC 2822 timestamp (in GMT) of when the Message resource was created.
-
#date_sent ⇒ Time
The RFC 2822 timestamp (in GMT) of when the Message was sent.
-
#date_updated ⇒ Time
The RFC 2822 timestamp (in GMT) of when the Message resource was last updated.
-
#delete ⇒ Boolean
Delete the MessageInstance.
- #direction ⇒ Direction
-
#error_code ⇒ String
The error code returned if the Message
statusisfailedorundelivered. -
#error_message ⇒ String
The description of the
error_codeif the Messagestatusisfailedorundelivered. -
#feedback ⇒ feedback
Access the feedback.
-
#fetch ⇒ MessageInstance
Fetch the MessageInstance.
-
#from ⇒ String
The sender's phone number (in E.164 format), alphanumeric sender ID, Wireless SIM, short code, or channel address (e.g.,
whatsapp:+15554449999). -
#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 associated with the Message resource.
-
#num_media ⇒ String
The number of media files associated with the Message resource.
-
#num_segments ⇒ String
The number of segments that make up the complete message.
-
#price ⇒ String
The amount billed for the message in the currency specified by
price_unit. -
#price_unit ⇒ String
The currency in which
priceis measured, in ISO 4127 format (e.g.usd,eur,jpy). -
#sid ⇒ String
The unique, Twilio-provided string that identifies the Message resource.
- #status ⇒ Status
-
#subresource_uris ⇒ Hash
A list of related resources identified by their URIs relative to
https://api.twilio.com. -
#to ⇒ String
The recipient's phone number (in E.164 format) or channel address (e.g.
whatsapp:+15552229999). -
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance.
-
#uri ⇒ String
The URI of the Message resource, relative to
https://api.twilio.com.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ MessageInstance
Initialize the MessageInstance
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 760 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
860 861 862 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 860 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
914 915 916 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 914 def api_version @properties['api_version'] end |
#body ⇒ String
806 807 808 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 806 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
797 798 799 800 801 802 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 797 def context unless @instance_context @instance_context = MessageContext.new(@version , @params['account_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
896 897 898 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 896 def date_created @properties['date_created'] end |
#date_sent ⇒ Time
890 891 892 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 890 def date_sent @properties['date_sent'] end |
#date_updated ⇒ Time
836 837 838 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 836 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the MessageInstance
927 928 929 930 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 927 def delete context.delete end |
#direction ⇒ Direction
818 819 820 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 818 def direction @properties['direction'] end |
#error_code ⇒ String
902 903 904 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 902 def error_code @properties['error_code'] end |
#error_message ⇒ String
848 849 850 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 848 def @properties['error_message'] end |
#feedback ⇒ feedback
Access the feedback
959 960 961 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 959 def feedback context.feedback end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
935 936 937 938 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 935 def fetch context.fetch end |
#from ⇒ String
824 825 826 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 824 def from @properties['from'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
979 980 981 982 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 979 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.MessageInstance #{values}>" end |
#media ⇒ media
Access the media
966 967 968 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 966 def media context.media end |
#messaging_service_sid ⇒ String
878 879 880 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 878 def messaging_service_sid @properties['messaging_service_sid'] end |
#num_media ⇒ String
866 867 868 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 866 def num_media @properties['num_media'] end |
#num_segments ⇒ String
812 813 814 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 812 def num_segments @properties['num_segments'] end |
#price ⇒ String
842 843 844 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 842 def price @properties['price'] end |
#price_unit ⇒ String
908 909 910 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 908 def price_unit @properties['price_unit'] end |
#sid ⇒ String
884 885 886 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 884 def sid @properties['sid'] end |
#status ⇒ Status
872 873 874 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 872 def status @properties['status'] end |
#subresource_uris ⇒ Hash
920 921 922 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 920 def subresource_uris @properties['subresource_uris'] end |
#to ⇒ String
830 831 832 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 830 def to @properties['to'] end |
#to_s ⇒ Object
Provide a user friendly representation
972 973 974 975 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 972 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
945 946 947 948 949 950 951 952 953 954 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 945 def update( body: :unset, status: :unset ) context.update( body: body, status: status, ) end |
#uri ⇒ String
854 855 856 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 854 def uri @properties['uri'] end |