class Twilio::REST::Api::V2010::AccountContext::MessageContext::MediaInstance
Public Class Methods
Initialize the MediaInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] account_sid
The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created this Media resource.
@param [String] message_sid The unique string that that we created to identify
the Message resource.
@param [String] sid The Twilio-provided string that uniquely identifies the
Media resource to fetch
@return [MediaInstance] MediaInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 247 def initialize(version, payload, account_sid: nil, message_sid: nil, sid: nil) 248 super(version) 249 250 # Marshaled Properties 251 @properties = { 252 'account_sid' => payload['account_sid'], 253 'content_type' => payload['content_type'], 254 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 255 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 256 'parent_sid' => payload['parent_sid'], 257 'sid' => payload['sid'], 258 'uri' => payload['uri'], 259 } 260 261 # Context 262 @instance_context = nil 263 @params = { 264 'account_sid' => account_sid, 265 'message_sid' => message_sid, 266 'sid' => sid || @properties['sid'], 267 } 268 end
Public Instance Methods
@return [String] The SID of the Account that created this resource
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 288 def account_sid 289 @properties['account_sid'] 290 end
@return [String] The default mime-type of the media
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 294 def content_type 295 @properties['content_type'] 296 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 [MediaContext] MediaContext
for this MediaInstance
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 274 def context 275 unless @instance_context 276 @instance_context = MediaContext.new( 277 @version, 278 @params['account_sid'], 279 @params['message_sid'], 280 @params['sid'], 281 ) 282 end 283 @instance_context 284 end
@return [Time] The RFC 2822 date and time in GMT that this resource was created
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 300 def date_created 301 @properties['date_created'] 302 end
@return [Time] The RFC 2822 date and time in GMT that this resource was last updated
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 306 def date_updated 307 @properties['date_updated'] 308 end
Delete the MediaInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 331 def delete 332 context.delete 333 end
Fetch the MediaInstance
@return [MediaInstance] Fetched MediaInstance
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 338 def fetch 339 context.fetch 340 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 351 def inspect 352 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 353 "<Twilio.Api.V2010.MediaInstance #{values}>" 354 end
@return [String] The SID of the resource that created the media
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 312 def parent_sid 313 @properties['parent_sid'] 314 end
@return [String] The unique string that identifies this resource
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 318 def sid 319 @properties['sid'] 320 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 344 def to_s 345 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 346 "<Twilio.Api.V2010.MediaInstance #{values}>" 347 end
@return [String] The URI of this resource, relative to `api.twilio.com`
# File lib/twilio-ruby/rest/api/v2010/account/message/media.rb 324 def uri 325 @properties['uri'] 326 end