Class: Twilio::REST::Events::V1::SchemaContext::SchemaVersionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/events/v1/schema/schema_version.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil, schema_version: nil) ⇒ SchemaVersionInstance

Initialize the SchemaVersionInstance

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 SchemaVersion resource.

  • sid (String)

    The SID of the Call resource to fetch.



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 380

def initialize(version, payload , id: nil, schema_version: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'schema_version' => payload['schema_version'] == nil ? payload['schema_version'] : payload['schema_version'].to_i,
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'url' => payload['url'],
        'raw' => payload['raw'],
    }

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

Instance Method Details

#contextSchemaVersionContext

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

Returns:



402
403
404
405
406
407
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 402

def context
    unless @instance_context
        @instance_context = SchemaVersionContext.new(@version , @params['id'], @params['schema_version'])
    end
    @instance_context
end

#date_createdTime

Returns The date the schema version was created, given in ISO 8601 format.

Returns:

  • (Time)

    The date the schema version was created, given in ISO 8601 format.



423
424
425
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 423

def date_created
    @properties['date_created']
end

#fetchSchemaVersionInstance

Fetch the SchemaVersionInstance

Returns:



442
443
444
445
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 442

def fetch

    context.fetch
end

#idString

Returns The unique identifier of the schema. Each schema can have multiple versions, that share the same id.

Returns:

  • (String)

    The unique identifier of the schema. Each schema can have multiple versions, that share the same id.



411
412
413
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 411

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



456
457
458
459
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 456

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

#rawString

Returns:

  • (String)


435
436
437
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 435

def raw
    @properties['raw']
end

#schema_versionString

Returns The version of this schema.

Returns:

  • (String)

    The version of this schema.



417
418
419
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 417

def schema_version
    @properties['schema_version']
end

#to_sObject

Provide a user friendly representation



449
450
451
452
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 449

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



429
430
431
# File 'lib/twilio-ruby/rest/events/v1/schema/schema_version.rb', line 429

def url
    @properties['url']
end