class Twilio::REST::IpMessaging::V1::ServiceContext::ChannelContext::MessageInstance

Public Class Methods

new(version, payload, service_sid: nil, channel_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] service_sid The service_sid @param [String] channel_sid The channel_sid @param [String] sid The sid @return [MessageInstance] MessageInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
255 def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil)
256   super(version)
257 
258   # Marshaled Properties
259   @properties = {
260       'sid' => payload['sid'],
261       'account_sid' => payload['account_sid'],
262       'attributes' => payload['attributes'],
263       'service_sid' => payload['service_sid'],
264       'to' => payload['to'],
265       'channel_sid' => payload['channel_sid'],
266       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
267       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
268       'was_edited' => payload['was_edited'],
269       'from' => payload['from'],
270       'body' => payload['body'],
271       'index' => payload['index'].to_i,
272       'url' => payload['url'],
273   }
274 
275   # Context
276   @instance_context = nil
277   @params = {
278       'service_sid' => service_sid,
279       'channel_sid' => channel_sid,
280       'sid' => sid || @properties['sid'],
281   }
282 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The account_sid

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
308 def account_sid
309   @properties['account_sid']
310 end
attributes() click to toggle source

@return [String] The attributes

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
314 def attributes
315   @properties['attributes']
316 end
body() click to toggle source

@return [String] The body

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
362 def body
363   @properties['body']
364 end
channel_sid() click to toggle source

@return [String] The channel_sid

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
332 def channel_sid
333   @properties['channel_sid']
334 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/ip_messaging/v1/service/channel/message.rb
288 def context
289   unless @instance_context
290     @instance_context = MessageContext.new(
291         @version,
292         @params['service_sid'],
293         @params['channel_sid'],
294         @params['sid'],
295     )
296   end
297   @instance_context
298 end
date_created() click to toggle source

@return [Time] The date_created

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
338 def date_created
339   @properties['date_created']
340 end
date_updated() click to toggle source

@return [Time] The date_updated

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
344 def date_updated
345   @properties['date_updated']
346 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
388 def delete
389   context.delete
390 end
fetch() click to toggle source

Fetch the MessageInstance @return [MessageInstance] Fetched MessageInstance

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
381 def fetch
382   context.fetch
383 end
from() click to toggle source

@return [String] The from

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
356 def from
357   @properties['from']
358 end
index() click to toggle source

@return [String] The index

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
368 def index
369   @properties['index']
370 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
410 def inspect
411   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
412   "<Twilio.IpMessaging.V1.MessageInstance #{values}>"
413 end
service_sid() click to toggle source

@return [String] The service_sid

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
320 def service_sid
321   @properties['service_sid']
322 end
sid() click to toggle source

@return [String] The sid

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
302 def sid
303   @properties['sid']
304 end
to() click to toggle source

@return [String] The to

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
326 def to
327   @properties['to']
328 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
403 def to_s
404   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
405   "<Twilio.IpMessaging.V1.MessageInstance #{values}>"
406 end
update(body: :unset, attributes: :unset) click to toggle source

Update the MessageInstance @param [String] body The body @param [String] attributes The attributes @return [MessageInstance] Updated MessageInstance

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
397 def update(body: :unset, attributes: :unset)
398   context.update(body: body, attributes: attributes, )
399 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
374 def url
375   @properties['url']
376 end
was_edited() click to toggle source

@return [Boolean] The was_edited

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb
350 def was_edited
351   @properties['was_edited']
352 end