Class: Twilio::REST::Serverless::V1::ServiceContext::AssetContext::AssetVersionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, asset_sid: nil, sid: nil) ⇒ AssetVersionInstance

Initialize the AssetVersionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this AssetVersion resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 384

def initialize(version, payload , service_sid: nil, asset_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'asset_sid' => payload['asset_sid'],
        'path' => payload['path'],
        'visibility' => payload['visibility'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Asset Version resource.

Returns:



424
425
426
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 424

def 
    @properties['account_sid']
end

#asset_sidString

Returns The SID of the Asset resource that is the parent of the Asset Version.

Returns:

  • (String)

    The SID of the Asset resource that is the parent of the Asset Version.



436
437
438
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 436

def asset_sid
    @properties['asset_sid']
end

#contextAssetVersionContext

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

Returns:



409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 409

def context
    unless @instance_context
        @instance_context = AssetVersionContext.new(@version , @params['service_sid'], @params['asset_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



454
455
456
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 454

def date_created
    @properties['date_created']
end

#fetchAssetVersionInstance

Fetch the AssetVersionInstance

Returns:



467
468
469
470
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 467

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



481
482
483
484
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 481

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

#pathString

Returns The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (‘/’). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.

Returns:

  • (String)

    The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (‘/’). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.



442
443
444
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 442

def path
    @properties['path']
end

#service_sidString

Returns The SID of the Service that the Asset Version resource is associated with.

Returns:

  • (String)

    The SID of the Service that the Asset Version resource is associated with.



430
431
432
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 430

def service_sid
    @properties['service_sid']
end

#sidString

Returns The unique string that we created to identify the Asset Version resource.

Returns:

  • (String)

    The unique string that we created to identify the Asset Version resource.



418
419
420
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 418

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



474
475
476
477
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 474

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

#urlString

Returns The absolute URL of the Asset Version resource.

Returns:

  • (String)

    The absolute URL of the Asset Version resource.



460
461
462
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 460

def url
    @properties['url']
end

#visibilityVisibility

Returns:

  • (Visibility)


448
449
450
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 448

def visibility
    @properties['visibility']
end