class Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::MessageContext

Public Class Methods

new(version, service_sid, channel_sid, sid) click to toggle source

Initialize the MessageContext @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] channel_sid The channel_sid @param [String] sid The sid @return [MessageContext] MessageContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
197 def initialize(version, service_sid, channel_sid, sid)
198   super(version)
199 
200   # Path Solution
201   @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, }
202   @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Messages/#{@solution[:sid]}"
203 end

Public Instance Methods

delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the MessageInstance @param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

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

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
225 def delete(x_twilio_webhook_enabled: :unset)
226   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
227 
228    @version.delete('DELETE', @uri, headers: headers)
229 end
fetch() click to toggle source

Fetch the MessageInstance @return [MessageInstance] Fetched MessageInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
208 def fetch
209   payload = @version.fetch('GET', @uri)
210 
211   MessageInstance.new(
212       @version,
213       payload,
214       service_sid: @solution[:service_sid],
215       channel_sid: @solution[:channel_sid],
216       sid: @solution[:sid],
217   )
218 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
273 def inspect
274   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
275   "#<Twilio.IpMessaging.V2.MessageContext #{context}>"
276 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
266 def to_s
267   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
268   "#<Twilio.IpMessaging.V2.MessageContext #{context}>"
269 end
update(body: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset, from: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the MessageInstance @param [String] body The body @param [String] attributes The attributes @param [Time] date_created The date_created @param [Time] date_updated The date_updated @param [String] last_updated_by The last_updated_by @param [String] from The from @param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [MessageInstance] Updated MessageInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb
242 def update(body: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset, from: :unset, x_twilio_webhook_enabled: :unset)
243   data = Twilio::Values.of({
244       'Body' => body,
245       'Attributes' => attributes,
246       'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
247       'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
248       'LastUpdatedBy' => last_updated_by,
249       'From' => from,
250   })
251   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
252 
253   payload = @version.update('POST', @uri, data: data, headers: headers)
254 
255   MessageInstance.new(
256       @version,
257       payload,
258       service_sid: @solution[:service_sid],
259       channel_sid: @solution[:channel_sid],
260       sid: @solution[:sid],
261   )
262 end