Class: Twilio::REST::Fax::V1::FaxContext::FaxMediaInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, fax_sid: nil, sid: nil) ⇒ FaxMediaInstance

Initialize the FaxMediaInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • fax_sid (String) (defaults to: nil)

    The SID of the fax the FaxMedia resource is associated with.

  • sid (String) (defaults to: nil)

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


210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 210

def initialize(version, payload, fax_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'fax_sid' => payload['fax_sid'],
      'content_type' => payload['content_type'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'fax_sid' => fax_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


248
249
250
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 248

def 
  @properties['account_sid']
end

#content_typeString

Returns The content type of the stored fax media.

Returns:

  • (String)

    The content type of the stored fax media


260
261
262
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 260

def content_type
  @properties['content_type']
end

#contextFaxMediaContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 233

def context
  unless @instance_context
    @instance_context = FaxMediaContext.new(@version, @params['fax_sid'], @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created


266
267
268
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 266

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated


272
273
274
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 272

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the FaxMediaInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


292
293
294
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 292

def delete
  context.delete
end

#fax_sidString

Returns The SID of the fax the FaxMedia resource is associated with.

Returns:

  • (String)

    The SID of the fax the FaxMedia resource is associated with


254
255
256
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 254

def fax_sid
  @properties['fax_sid']
end

#fetchFaxMediaInstance

Fetch the FaxMediaInstance

Returns:


285
286
287
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 285

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


305
306
307
308
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 305

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Fax.V1.FaxMediaInstance #{values}>"
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


242
243
244
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 242

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


298
299
300
301
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 298

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Fax.V1.FaxMediaInstance #{values}>"
end

#urlString

Returns The absolute URL of the FaxMedia resource.

Returns:

  • (String)

    The absolute URL of the FaxMedia resource


278
279
280
# File 'lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb', line 278

def url
  @properties['url']
end