Class: Twilio::REST::Api::V2010::AccountContext::MessageContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::MessageContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/message.rb,
lib/twilio-ruby/rest/api/v2010/account/message/media.rb,
lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb
Defined Under Namespace
Classes: FeedbackInstance, FeedbackList, FeedbackPage, MediaContext, MediaInstance, MediaList, MediaPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the MessageInstance.
-
#feedback ⇒ FeedbackList, FeedbackContext
Access the feedback.
-
#fetch ⇒ MessageInstance
Fetch the MessageInstance.
-
#initialize(version, account_sid, sid) ⇒ MessageContext
constructor
Initialize the MessageContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance.
Constructor Details
#initialize(version, account_sid, sid) ⇒ MessageContext
Initialize the MessageContext
261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 261 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Messages/#{@solution[:sid]}.json" # Dependents @feedback = nil @media = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the MessageInstance
275 276 277 278 279 280 281 282 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 275 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#feedback ⇒ FeedbackList, FeedbackContext
Access the feedback
338 339 340 341 342 343 344 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 338 def feedback unless @feedback @feedback = FeedbackList.new( @version, account_sid: @solution[:account_sid], message_sid: @solution[:sid], ) end @feedback end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 287 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) MessageInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
374 375 376 377 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 374 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 349 def media(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return MediaContext.new(@version, @solution[:account_sid], @solution[:sid],sid ) end unless @media @media = MediaList.new( @version, account_sid: @solution[:account_sid], message_sid: @solution[:sid], ) end @media end |
#to_s ⇒ Object
Provide a user friendly representation
367 368 369 370 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 367 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 309 def update( body: :unset, status: :unset ) data = Twilio::Values.of({ 'Body' => body, 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) MessageInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |