Class: Twilio::REST::Api::V2010::AccountContext::MessageContext::MediaContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/message/media.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, message_sid, sid) ⇒ MediaContext

Initialize the MediaContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the Account that created the Media resource(s) to fetch.

  • message_sid (String)

    The SID of the Message resource that this Media resource belongs to.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Media resource to fetch


189
190
191
192
193
194
195
# File 'lib/twilio-ruby/rest/api/v2010/account/message/media.rb', line 189

def initialize(version, , message_sid, sid)
  super(version)

  # Path Solution
  @solution = {account_sid: , message_sid: message_sid, sid: sid, }
  @uri = "/Accounts/#{@solution[:account_sid]}/Messages/#{@solution[:message_sid]}/Media/#{@solution[:sid]}.json"
end

Instance Method Details

#deleteBoolean

Delete the MediaInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


200
201
202
# File 'lib/twilio-ruby/rest/api/v2010/account/message/media.rb', line 200

def delete
   @version.delete('DELETE', @uri)
end

#fetchMediaInstance

Fetch the MediaInstance

Returns:


207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/api/v2010/account/message/media.rb', line 207

def fetch
  payload = @version.fetch('GET', @uri)

  MediaInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      message_sid: @solution[:message_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


228
229
230
231
# File 'lib/twilio-ruby/rest/api/v2010/account/message/media.rb', line 228

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.MediaContext #{context}>"
end

#to_sObject

Provide a user friendly representation


221
222
223
224
# File 'lib/twilio-ruby/rest/api/v2010/account/message/media.rb', line 221

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Api.V2010.MediaContext #{context}>"
end