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

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, 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

  • service_sid (String) (defaults to: nil)

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

  • asset_sid (String) (defaults to: nil)

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

  • sid (String) (defaults to: nil)

    The SID of the Asset Version resource to fetch.


220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 220

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,
      'asset_sid' => asset_sid,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the Asset Version resource.

Returns:

  • (String)

    The SID of the Account that created the Asset Version resource


268
269
270
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 268

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


280
281
282
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 280

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:


248
249
250
251
252
253
254
255
256
257
258
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 248

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 ISO 8601 date and time in GMT when the Asset Version resource was created.

Returns:

  • (Time)

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


298
299
300
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 298

def date_created
  @properties['date_created']
end

#fetchAssetVersionInstance

Fetch the AssetVersionInstance

Returns:


311
312
313
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 311

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


324
325
326
327
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 324

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.

Returns:

  • (String)

    The URL-friendly string by which the Asset Version can be referenced


286
287
288
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 286

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


274
275
276
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 274

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the Asset Version resource.

Returns:

  • (String)

    The unique string that identifies the Asset Version resource


262
263
264
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 262

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


317
318
319
320
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 317

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


304
305
306
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 304

def url
  @properties['url']
end

#visibilityasset_version.Visibility

Returns The access control that determines how the Asset Version can be accessed.

Returns:

  • (asset_version.Visibility)

    The access control that determines how the Asset Version can be accessed


292
293
294
# File 'lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb', line 292

def visibility
  @properties['visibility']
end