class Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::MessageInstance
Public Class Methods
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
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 288 def initialize(version, payload, service_sid: nil, channel_sid: nil, sid: nil) 289 super(version) 290 291 # Marshaled Properties 292 @properties = { 293 'sid' => payload['sid'], 294 'account_sid' => payload['account_sid'], 295 'attributes' => payload['attributes'], 296 'service_sid' => payload['service_sid'], 297 'to' => payload['to'], 298 'channel_sid' => payload['channel_sid'], 299 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 300 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 301 'last_updated_by' => payload['last_updated_by'], 302 'was_edited' => payload['was_edited'], 303 'from' => payload['from'], 304 'body' => payload['body'], 305 'index' => payload['index'].to_i, 306 'type' => payload['type'], 307 'media' => payload['media'], 308 'url' => payload['url'], 309 } 310 311 # Context 312 @instance_context = nil 313 @params = { 314 'service_sid' => service_sid, 315 'channel_sid' => channel_sid, 316 'sid' => sid || @properties['sid'], 317 } 318 end
Public Instance Methods
@return [String] The account_sid
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 344 def account_sid 345 @properties['account_sid'] 346 end
@return [String] The attributes
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 350 def attributes 351 @properties['attributes'] 352 end
@return [String] The body
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 404 def body 405 @properties['body'] 406 end
@return [String] The channel_sid
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 368 def channel_sid 369 @properties['channel_sid'] 370 end
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/v2/service/channel/message.rb 324 def context 325 unless @instance_context 326 @instance_context = MessageContext.new( 327 @version, 328 @params['service_sid'], 329 @params['channel_sid'], 330 @params['sid'], 331 ) 332 end 333 @instance_context 334 end
@return [Time] The date_created
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 374 def date_created 375 @properties['date_created'] 376 end
@return [Time] The date_updated
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 380 def date_updated 381 @properties['date_updated'] 382 end
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 444 def delete(x_twilio_webhook_enabled: :unset) 445 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 446 end
Fetch the MessageInstance
@return [MessageInstance] Fetched MessageInstance
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 435 def fetch 436 context.fetch 437 end
@return [String] The from
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 398 def from 399 @properties['from'] 400 end
@return [String] The index
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 410 def index 411 @properties['index'] 412 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 480 def inspect 481 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 482 "<Twilio.IpMessaging.V2.MessageInstance #{values}>" 483 end
@return [String] The last_updated_by
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 386 def last_updated_by 387 @properties['last_updated_by'] 388 end
@return [Hash] The media
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 422 def media 423 @properties['media'] 424 end
@return [String] The service_sid
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 356 def service_sid 357 @properties['service_sid'] 358 end
@return [String] The sid
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 338 def sid 339 @properties['sid'] 340 end
@return [String] The to
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 362 def to 363 @properties['to'] 364 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 473 def to_s 474 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 475 "<Twilio.IpMessaging.V2.MessageInstance #{values}>" 476 end
@return [String] The type
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 416 def type 417 @properties['type'] 418 end
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 459 def update(body: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, last_updated_by: :unset, from: :unset, x_twilio_webhook_enabled: :unset) 460 context.update( 461 body: body, 462 attributes: attributes, 463 date_created: date_created, 464 date_updated: date_updated, 465 last_updated_by: last_updated_by, 466 from: from, 467 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 468 ) 469 end
@return [String] The url
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 428 def url 429 @properties['url'] 430 end
@return [Boolean] The was_edited
# File lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb 392 def was_edited 393 @properties['was_edited'] 394 end